Re: How do I run Form2, from Form1 ?
Thank you for your comments and thank you for continuing to help.
I built this application to try to learn more about C++ so, least for me,
it???s become a bit of an interesting quest that???s telling me a lot about how
C++ works.
Over in Form2.h??? I have the following code???
namespace Test_Forms_Application {
/// <summary>
/// Summary for Form2
///
/// the machine-generated warning text is here???
///
/// </summary>
public ref class Form2 : public System::Windows::Forms::Form
{
public:
. . . etc???
The same text is in Form1.h where one of the lines is ???
namespace Test_Forms_Application {
with code for Form1 below that.
So I tried both of the following code items in the
Onclick method for the button in
private: System::Void button3_Click(System::Object^ sender,
System::EventArgs^ e) {
/*
// test code A
using Test_Forms_Application;
Form2^ pForm2 = gcnew Form2();
pForm2->ShowDialog(); // show modal
*/
// or???
// test code B
Test_Forms_Application::Form2^ pForm2 = gcnew Form2();
pForm2->ShowDialog(); // show modal
}
Now the errors are as follows???
// error for test code A
error C2873: 'Test_Forms_Application' : symbol cannot be used in a
using-declaration
// error for test code B
error C2039: 'Form2' : is not a member of 'Test_Forms_Application'
and that just doesn???t make sense, so I???ve clearly made some other error
somewhere. When I click on menu shoices ??? ???project???, and then, ???show all
files??? I see tabs in the workspace that show both Form1.h and form2.h. Is it
possible that somehow Form2 is not part of the project and I???m clearly not
seeing it?
Keith