"Maarten" <gu******@hotmail.com> schrieb:
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()
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>