I'm having problems with one of my projects. I created a windows .net form and want to include more than one namespace in the class. I create the second class after my form class but when I compile it doesn't recognize the data. I get a syntax error (Syntax Error: Identifier accessData) and a undeclared identifier error. If I move the second class to the top everything works but then the designer wont run. How can I use this class or define it before the first class? Here is an example:
namespace spaceName
{
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
........... Code here
// Trying to call the second class here:
accessData* data = new AccessData();
}; // end the class
// Create another class
public __gc clase accessData
{
.. Code here
};
} // End Namespace
Multiple classes in one namespace
Started by
Guest_NeedHelp_*
, Jun 24 2006 09:01 AM
2 replies to this topic
#1
Guest_NeedHelp_*
Posted 24 June 2006 - 09:01 AM
Guest_NeedHelp_*
|
|
|
#2
Posted 26 June 2006 - 11:08 AM
The first class has to be class derived from the Form. That is why you see a designer error.
You can do a forward declaration in Form.h to get it to work or simply create a new class file for your project.
You can do a forward declaration in Form.h to get it to work or simply create a new class file for your project.
#3
Guest_NeedHelp_*
Posted 29 June 2006 - 12:35 PM
Guest_NeedHelp_*
Ahh, I see. If I move the first class the designer doesn't work. I've put the class in a seperate file and included it which also works just fine. How do I do a forward declaration?


Sign In
Create Account

Back to top










