473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.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

Mar 11 '08 #1
2 2984
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
"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.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
Mar 11 '08 #2
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.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
Mar 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Philippe | last post by:
hi everybody, I let the user enter values in a Child Form. How can I post those values back to the MDIParent Form (which uses these values) ? By the way, is it possible to access Public...
0
by: GarryFre | last post by:
I've written up this neat screensaver, but it has a few bits of ugliness to it ... 1. I both know how to get the handle for a preview and the handle for the window to display a settings dialog...
2
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open....
16
by: John | last post by:
Hi I have posted this question several times but have received no reply. I have a main form which contains a panel which in turn contains a child form, like this; MainForm->MyPanel->ChildForm....
3
by: Maarten | last post by:
hi, how can i pass data from a parrentform to a childform and reverse or retreave data from a childform of the parentform and reverse. Regards Maarten
14
by: 97T | last post by:
Well this is still bugging me. I know there are other ways around this, but for a number of reasons I would like to be able to do this one simple thing. I have a form with a number of controls...
4
by: Ryan | last post by:
I've got a little bit of code that runs when you enter data in a datasheet view (which is a subform of the form you are in) if rst!DateReceived >= 30 Then Forms!DisposalRecords.Label90.Caption =...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.