From: Keith on 23 Apr 2010 00:39 Hello, I have a C++ Express 2008 program with two forms, Form1, and Form2. Form1 has a button, Button2, which has the method shown below. I would like to know what code needs to go into the method to run and show, Form2. private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { // what goes here to open and show Form2 ? } Thank you, Keith
From: Faisal on 23 Apr 2010 01:35 On Apr 23, 9:39 am, Keith <Ke...(a)discussions.microsoft.com> wrote: > Hello, > > I have a C++ Express 2008 program with two forms, Form1, and Form2. > > Form1 has a button, Button2, which has the method shown below. I would like > to know what code needs to go into the method to run and show, Form2. > > private: System::Void button3_Click(System::Object^ sender, > System::EventArgs^ e) > { > // what goes here to open and show Form2 ? > > } > > Thank you, > > Keith Just create the Form2 and show it Form2^ pForm2 = gcnew Form2(); pForm2 ->ShowDialog(); For showing as modal or pForm2 ->Show() //non-modal
From: Keith on 23 Apr 2010 08:23 Hello Faisal, Thank you very much. Keith
From: Keith on 23 Apr 2010 22:45 Hello, I appreciate the assistance. I used the text shown below, and received an “undeclared identifier” error. What have I missed? private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { Form2^ pForm2 = gcnew Form2();//error C2065: 'Form2' : undeclared identifier pForm2->ShowDialog(); // show modal //Form2a->Show(); // show non-modal } Keith
From: Faisal on 25 Apr 2010 23:41
On Apr 24, 7:45 am, Keith <Ke...(a)discussions.microsoft.com> wrote: > Hello, > > I appreciate the assistance. I used the text shown below, and received an > undeclared identifier error. What have I missed? > > private: System::Void button3_Click(System::Object^ sender, > System::EventArgs^ e) { > > Form2^ pForm2 = gcnew Form2();//error C2065: 'Form2' : undeclared identifier > pForm2->ShowDialog(); // show modal > //Form2a->Show(); // show non-modal > > } > > Keith You need to include the Form2 declared file in your .cpp file. If Form2 is defined in form2.h use #include <form2.h> |