Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


(.NET) Accessing "parent" Form class members from a "child" form?

This topic is 5621 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 have a main MDI form as my startup object. From there I have it setup so that when I click on a menu item, it spawns a new instance of a form that it my level editing window for my game (lets call it''s class Form2). It is also owned by the main form if that matters. Anyway, what my problem is, is that I can''t access the public members of the main form (Form1) that created the editing window (Form2), but I can have the Form1 access the public members of the Form2 that it created. (Which make sense.) So, why can''t I have Form2 access the members of Form1? The IDE told me that it wasn''t a shared member, so I changed the variable from Public to Shared and it worked just fine. However, I was under the assumption that Shared was only used to share a member of a class with other instances of the same class. In my case (even though technically they both inherit from the Forms object) they are different classes.

Share this post

Link to post
Share on other sites

  • 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!