Parent Form Access

  • Thread starter Thread starter cbrown
  • Start date Start date
C

cbrown

I have two forms Main & Child. Main has several readonly properties
that I would like to access from the child form. How do I reference
the MDI-Parent form MAIN and use those properties.
 
I have two forms Main & Child. Main has several readonly properties
that I would like to access from the child form. How do I reference
the MDI-Parent form MAIN and use those properties.

if you set the parent property (it may be set automatically not too
sure) of the child then you can access it though:

Childform.Parent.PublicPropertyOrMethod

Then you just need to make a method or property to allow you to do what
you want.

Chris
 
cbrown,

On the mdi-child form, dimension a variable of type mdi-parent form:

Dim frm As mdiMain

Then assign the mdi-child form's MDIParent to the variable:

frm = Me.MdiParent

Now access the properties. For example, if the mdi-parent form has a
property named MyProp:

MsgBox(frm.MyProp)

Kerry Moorman
 
Back
Top