Calling MDI Parent Form Methods From MDIChild Form

Posted by Initiotech under VB.NET category on | Views : 9042
The Code below will demonstrate the procedure of calling an MDIParent Method from an MDIChild Form.

In many cases where we use a MDIParent Form which has some menus disabled we require it to be enabled from a Login Form which is the MDIChild Form.The below code will help you solve the querry.

Solution :
The MDI Parent Form :
A) Making the Methods Public

Public Sub Enable()
SpecialToolStripMenuItem.Enabled = True
End Sub

B) Calling the Method from an MDI Child.This code will be written in the child form where you want the parent form method to be called.

Dim f As Form1 = Me.MdiParent

In this case the Form1 is the MDIParent Form.
The instance of Form1 f is Initialised with the Me.MdiParent which will get the reference of the MDI Parent Form.

Hefin Dsouza

Comments or Responses

Login to post response