Forms in VC++
Posted 07 March 2006 - 04:15 PM
Posted 25 March 2006 - 01:39 PM
static pointer I think I used in C# actually so if you're using C++ then just have a member pointer to a Form in the 2nd class & make an overloaded constructor to accept a Form pointer. Then when instantiating the 2nd form pass it the 'this' pointer from the 1st form (as long as you're instantiating it from the 1st form) and assign the passed in pointer to the already created Form pointer member in the 2nd Form. Then you can use the passed in pointer to access all of Form1's members.
Form2 *newForm = new Form2(this);
public Form2(Form *a1stForm) //new constructor
mForm1 = a1stForm;
mForm1->Text = "Accessed from Form2";
Edited by StephenL, 25 March 2006 - 02:32 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users