Jump to content
  • Advertisement
Sign in to follow this  

MDI with VB 6

This topic is 4552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i'm just starting to get into MDI projects and i was wondering what are all the facts about having an MDI documents. like will the "dim" variables in the MDI document have scope in the child documents or vice versa, can the global variables in a module be changed in the MDI document and child document, etc. thank you

Share this post

Link to post
Share on other sites
If you have an MDI container form, and declare local/member variables in there, no, the child forms do not automatically gain access to these variables. VB6 only allows one MDI form to exist at any point in time, so it's easy to know which MDI contains any child form. Thus you can add functions to get/set these variables, or better yet, provide an actual interface.

Global variables in a module can be indeed changed anywhere [smile]

In an MDI child form, each child form gets its own set of member variables. If you've used an Object Oriented Programming Language before, it's best to think of the name of the form as a class rather than an object.

In a simple VB application, you might write:

Form1.Text1.Text = "DGF"

this shows that Form1 can be treated as an object. But you can have more than one Form1:

Dim Form1Instance1 As New Form1
Dim Form1Instance2 As New Form1
Form1Instance1.Text1.Text = "SIX FIVE FIVE THREE SIX"
Form1Instance2.Text1.Text = "FIVE NINER OH FOUR EIGHT"
Debug.Assert Form1Instance2.Text1.Text <> Form1Instance1.Text1.Text

in this case, each instance of Form1 has its own set of controls, member variables, etc.

[Edited by - MrEvil on April 2, 2006 9:57:49 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!