Cannot Reference Parent variables from a MDI Child Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U2FuZHk=?=

    #1

    Cannot Reference Parent variables from a MDI Child Form

    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.M diChildren.Leng th so I can
    manipulate the forms to determine if the form I am concerned with is not open.

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

    Totally confusing

    thanks
    sandy



  • =?Utf-8?B?S2VycnkgTW9vcm1hbg==?=

    #2
    RE: Cannot Reference Parent variables from a MDI Child Form

    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.Test Var)

    Kerry Moorman


    "Sandy" wrote:
    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.M diChildren.Leng th so I can
    manipulate the forms to determine if the form I am concerned with is not open.
    >
    When I reference MDIParentForm.M diChildren.Leng th from the MDI Child in the
    coder it always shows 0 (Zero)
    When I hold my cursor over MDIParentForm.M diChildren.Leng th in the IDE it
    displays 3 which is the correct number of MDI Child forms that are open.
    >
    Totally confusing
    >
    thanks
    sandy
    >
    >
    >

    Comment

    • =?Utf-8?B?U2FuZHk=?=

      #3
      RE: Cannot Reference Parent variables from a MDI Child Form

      Kerry,

      thank you, thank you, thank you

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

      regards
      sandy

      "Sandy" wrote:
      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.M diChildren.Leng th so I can
      manipulate the forms to determine if the form I am concerned with is not open.
      >
      When I reference MDIParentForm.M diChildren.Leng th from the MDI Child in the
      coder it always shows 0 (Zero)
      When I hold my cursor over MDIParentForm.M diChildren.Leng th in the IDE it
      displays 3 which is the correct number of MDI Child forms that are open.
      >
      Totally confusing
      >
      thanks
      sandy
      >
      >
      >

      Comment

      Working...