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
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.
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?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks