I created 2 forms formA and formB.
FormB is created by formA.
I need to refer to formA from formB.
There is this property called “ParentForm” can that be used?
Janaka
Printable View
I created 2 forms formA and formB.
FormB is created by formA.
I need to refer to formA from formB.
There is this property called “ParentForm” can that be used?
Janaka
The ParentForm property gets the parent of a MDI child.
A way for you migth be to keep a reference. You could do that by creating your own Sub New for your FormB where you pass a reference to the Form as an argument.
You then use something like this from FormA:Code:#Region " Windows Form Designer generated code "
Dim mainForm As FormA
Public Sub New(ByVal mForm)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
mainForm = mForm
End Sub
You then have a reference to the Form via the mainForm variable.Code:Dim frm As New FormB(Me)
frm.Show()
/Leyan