I am using Visual C++ 2005 and I am creating an application that has various forms. What I am wanting to happen is when a new form is opened the previous one is closed. I'm sure it's just one line of code that I need to add but being new to this I have no idea what that is. The form I want to close is Form1.h. Any help would be much appreciated.
Here is my current code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Parts ^parts = gcnew Parts();
parts->ShowDialog();
this->Close();
You can do that by simply calling the Close() method from the form you wish to close. Have you tried that?