Link to home
Start Free TrialLog in
Avatar of fenriss_wolff
fenriss_wolff

asked on

sharing variables/information between two forms

Background:
Visual c++ .net express 2005
windows xp


I have two forms, inside the same application. Form1 creates Form2, so I assume it is a "child" of some sort. Anyway, I am collecting data via rs232 in the main form (form1) and would like to pass that information to form2. I was looking for some function like "GetParent" to get a handle to the original or any other way that is typical to pass information between forms. I have tried to even compile an old c++ singleton class that I have to share the information, but it doesn't mix well with managed c++ (because of the static variables?) . Anyway, is there a "proper" way to handle this ? I don't really want an MDI type solution. I would like this to all be independent forms so that non pertinent forms can just be minimized or hidden when they aren't needed, as well as the ability to see both forms. Sample code would be most helpful! I'm pretty wet behind the ears on this, as I usually just do embedded C and VHDL.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Knut Hunstad
Knut Hunstad
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fenriss_wolff
fenriss_wolff

ASKER

I'm so new that I didn't even know you forms were inherited, and all I needed to do was create a set function with a pointer to my data that I want to pass from Form1 . Thx!