Cannot Reference Parent variables from a MDI Child Form

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

Hi everyone

Some help pls.

1. MDI Parent Form
Have a variable Public TestVariable As String = "AAA"

In the Load procedure TestVariable = "BBB"

2. MDI Child Form

Do a debug.print (TestVariable) and displays "AAA"

If I hold my cursor over TestVariable in the IDE it
displays "BBB"


I do not see how I can reference the current value in TestVariable of "BBB"
in my code

The real reason for this is that I am in 1 MDI child form and I want to
determine if another MDI Child form is active
I want to get the value MDIParentForm.MdiChildren.Length so I can
manipulate the forms to determine if the form I am concerned with is not open.

When I reference MDIParentForm.MdiChildren.Length from the MDI Child in the
coder it always shows 0 (Zero)
When I hold my cursor over MDIParentForm.MdiChildren.Length in the IDE it
displays 3 which is the correct number of MDI Child forms that are open.

Totally confusing

thanks
sandy
 
Sandy,

From the child form you need to reference variables in the mdiparent form
like this:

Dim frm As MDIParentForm

frm = Me.MdiParent

MsgBox(frm.TestVar)

Kerry Moorman
 
Kerry,

thank you, thank you, thank you

This resolved my problem completely. I would have never figured this out
on my own.

regards
sandy
 
Back
Top