|
-
Nov 4th, 2009, 10:19 AM
#1
Thread Starter
New Member
Visual C++ - opening and closing forms
Bit of a problem. I'm pretty new to using Visual C++ (I'm using the 2008 Express Edition).
I'm creating a Windows Forms application which is pretty straightforward. I've got everything working so far, except I need to know how to open and close the forms themselves.
I've created a menu system which the user can navigate. I want it so that clicking a button will show a particular form whilst hiding the form we came from.
I did actually manage to get a fair bit of this working by declaring the forms at the top (#include "form1.h" and all that lot) and could actually open the forms using:
Code:
Form1 ^ form = gcnew Form1;
form->ShowDialog();
Unfortunately, whilst this does work, because I have to specify the .h files in each form's code it seems to overload it (although I do only have four forms). I think it's a Visual C++ version of a circular reference as form1 has to load form2's .h which in turn loads form1's...
Also, how do I close a form when another form opens?
Any help would be much appreciated - this is the final thing that needs sorting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|