From: Keith on
Thanks very much for continuing to answer my questions.

I tried a couple of options and included the following two lines...

#include "Form1.h"
#include <Form2.h> // also tried.... #include "Form2.h"

and both ended up with the same error. I must have something else wrong.

Keith



From: Faisal on
On Apr 27, 5:34 am, Keith <Ke...(a)discussions.microsoft.com> wrote:
> Thanks very much for continuing to answer my questions.
>
> I tried a couple of  options and included the following two lines...
>
> #include "Form1.h"
> #include <Form2.h> // also tried....   #include "Form2.h"
>
> and both ended up with the same error.  I must have something else wrong.
>
> Keith

Check whether the Form2 class defined in a different namespace. If so,
use full namespace qualifier when using Form2 class.
like
Form2Namespace::Form2^ form2 = gcnew Form2Namespace::Form2;

or add
using Form2Namespace;
Form2^ = gcnew Form2;
From: Keith on

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



From: Keith on
Thank you very much.
It's going to take me a day or so to test this one.
Keith


From: Keith on
Hi Faisal,

I sincerely appreciate your help. I've probably made a mistake that isn't
revealing itself yet. I think I'm going to set the problem aside and work
on some other areas for awhile ... maybe recreate the whole project to see if
this issue continues to exist. I just bought Visual Studio, so it will be a
perfect time to recreate it in that new platform after the disks arrive.

Thanks so very much.

Keith