howto embed a panel class to different forms

  • Thread starter Thread starter rocio
  • Start date Start date
R

rocio

I have a Panel that I'm using as a dialog box.
But I need to display this dialog in different forms, depending on the
actions of the user.
The easiest/fastest way of doing this would be to define the panel on each
form, and use it as appropriate.
But I know the Panel can be defined in another form (frmPanel), then
instanciate that form in the other forms that need this panel, and somehow
add the nael from frmPanel into the call form.

How exactly can I do this?
 
First you need to know the code that "creates" your panel.
Navigate your frmPanel source for for it.
Look at the form initialization routine.
There you get your control created and the attributes set.
Take special attention with the Me.Controls.Add(YourPanel).
Here you associates the frmPanel and YourPanel as Parent and Child.

Well, you could study this code, manually create one, and
associate it with the form you want when you have to use it.

Well, I think that's a good start....

One more little thing: I don't know what could happen
if your panel gets disposed when a form to which it is
attatched gets closed...
 
Back
Top