Windows Develop Bookmark and Share   
 index > Windows Forms General > Problem with opening forms in VC++2005 Express
 

Problem with opening forms in VC++2005 Express

Hello,

I'm currently toying around with the newly released VC++2005 Express edition to refresh my dated C++ knowledge. So I created me a simple form with a button that I wanted to use to open another form. Both forms are in the same project, Intellisense is showing me the second form's class, and I'm following the examples in the documentation for calling the second form - still, when I try to build the project I get the error message that the second form's class couldn't be found in the project...

private: System::Void btnOpenForm_Click(System::Object^  sender, System::EventArgs^  e) {
                 FormTest::Form2 ^newForm = gcnew FormTest::Form2();
                 newForm->ShowDialog();
}

I made a simple (two forms, one button) example solution to show the problem. It might be my lack of knowledge in VC++ that leads to this problem, but I presented this first in a regular C++ forum and nobody was able to tell my why the code didn't work... So is this a bug in VC++ 2005 (some internal references not getting set) or is it just me? If the latter then some hint would be very much appreciated!
 :(
Joltan  Monday, November 14, 2005 4:21 PM

Are the two forms defined in the same header/source file? If form2 is defined in form2.h make sure that you include that in the files where you want to use it.

JeroGrav  Tuesday, November 15, 2005 6:02 AM
 JeroGrav wrote:
Are the two forms defined in the same header/source file? If form2 is defined in form2.h make sure that you include that in the files where you want to use it.

DOH! Thanks for the hint, it works fine now. Being used to code C# & Java I thought it should work by simply having them in the same project.
Joltan  Tuesday, November 15, 2005 7:33 AM

You can use google to search for other answers

Custom Search

More Threads

• How to create a Wizard with Windows Forms?
• Help finishing my printing, IM SO CLOSE!
• Making a control anisotropic?(EDIT-28.08-finally fixed)
• clicking on and moving the image in a picture box
• Creating a thread
• Use lan printer
• DataGrid and database bound - how then save the new value?
• How can i play all video filles ie wmv, avi, ect: from a specified folder?
• Process.Start of xcopy doesn't work under winforms, same code DOES work in a console app
• adding a form created by a diff. developer to a windows forms project