MDI Forms (vb.net)

otherside

Centurion
Joined
Mar 16, 2003
Messages
127
Location
UK - Greece
Does anyone have a good knowledge of MDI ?
Here is a question:

When i need to open a new form in a parent form i use this line

Assume parent form is Form1

sub button_click (button in Form1)

Dim fo As New Form2
fo.MdiParent = Me
fo.show

I can do this when i'm creating the new instance of Form2 whithin the parent Form.
When i need to create the instance of Form2 and set to it that the parent will be Form1, from a module or another Form, how can i do that ?

Ex.
Module Module1

public sub openform

Dim fo As New Form2
fo.MDIParent = ?????
fo.show

Note: Form1 is the starting Form so no instance is being set.
 
Use a shared field on Form1 to store the one instance that is created, you can set it in the constructor or anywhere.
 
Back
Top