Help - Assigning MDI Child to MDI Container when called in a Modul

G

Guest

I am trying to figure out how to assign the child form to the mdi container,
in VB, when the child is called from a module and not from the container form.

I know when called from the container form it is just:
dim form1 as new form1
form1.MDIParent = me (being the container form)

but this does not work when you do this in a module.

Thanks

Leo
 
C

Christof Nordiek

Hi Leo,

the module has to know wich shall be the MDIParent.
There are two options:
1. Their is a shared variable (or a variable in a module) that is assignd
the parent.
This would be the best option if there is one MDIParent in your app, wich
most probably is true.

2. The method puting the form in the container has a parameter wich is the
MDIParent.
Then the caller has do know, which form shall be the MDIParent.
 
G

Guest

Thanks for the help. I used suggestion 1. I created a public variable and
assigned the mdi container (MDIFORM1) to it on program start.
Public mdi as Form
mdi = Me

Then in the code mudule it became simple:
Dim fm as new Form1
fm.MDIParent = mdi

It works.

Thanks

Leo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top