I probably should know how to do this, but I don't. I need to make a program that uses multiple forms. Say that I have FormA, that opens when you compile, and when you push button1, it closes FormA and opens FormB.
C++ Form Transitions
Collapse
X
-
Forms have a close method, and a show method. Should be pretty apparent how to use them in your handler.Originally posted by dde334I probably should know how to do this, but I don't. I need to make a program that uses multiple forms. Say that I have FormA, that opens when you compile, and when you push button1, it closes FormA and opens FormB. -
No. Use formB's Show method, not the current instance's.Originally posted by dde334I tried that, but the output sais that FormB is an undeclared identifier. Is there some sort of declaration that I need, or am I doing is wrong?
Code:Show(Project::FormB);
Code:FormB ^ MyFormB = gcnew FormB; MyFormB->Show(); this->Close();
Comment
-
Thanks, but when I am editing FormA, it wont work when I try to make it open FormB. Is there some other type of declaration, or something I need to do to FormB? They are both in the same project.Originally posted by Sick0FantNo. Use formB's Show method, not the current instance's.
Code:FormB ^ MyFormB = gcnew FormB; MyFormB->Show(); this->Close();
Comment
-
Could you be a bit more specific? Does it not compile? Does it run, but not the way you thought it would?Originally posted by dde334Thanks, but when I am editing FormA, it wont work when I try to make it open FormB. Is there some other type of declaration, or something I need to do to FormB? They are both in the same project.Comment
-
Did you declare your "FormB" object like I did? I confirmed that the way I declared the form works. Something tells me that either the way you declared it wasn't correct, or else it's out of scope by the time you try to use it's method. You should be placing the code I gave you in the event method of FormA which will open FormB.Originally posted by dde334It doesnt compile, and the error says FormB: undeclared identifier.Comment
Comment