MDI parrent select

  • Thread starter Thread starter Maarten
  • Start date Start date
M

Maarten

sry for the title of previues message

Worksheet(formcount).MdiParent = Form1

i get an erro by form 1 he sais it is a type and con't be used as expresion1
but when i run this code from the MDI form and i type


Worksheet(formcount).MdiParent = Me

then the code is working

why ? and how wil i get it to work

thank you Maarten
 
Maarten,

Supposing that Form1 is the class name of your Form.

Could you ever do on any other place this
myobject = myclass?

Me is the object of your form.

Cor
 
thanks for the reply

but how wil i be able to tell in form3 tha the parent form of form2 is
form1?

thanks
 
Maarten said:
sry for the title of previues message

Worksheet(formcount).MdiParent = Form1

i get an erro by form 1 he sais it is a type and con't be used as
expresion1
but when i run this code from the MDI form and i type


Worksheet(formcount).MdiParent = Me

then the code is working

What you need is a reference to your instance of the MDI container. Inside
the MDI container, this reference is avalilable through 'Me'. Outside the
container form it's not available by default. You'll have to make the
reference available to the class/method where you are attempting to set the
MDI parent, for example, by passing it to a method in a parameter or by
setting a reference to the MDI container instance. An alternative approach
would be implementing the Singleton design pattern with the MDI container in
order to easily access it.

If you want to set the MDI parent for a form from within another MDI child,
you can use this code:

\\\
Dim f As New FooForm()
f.MdiParent = Me.MdiParent
f.Show()
///
 

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

Back
Top