I have this code that opens a Form. This code does work but if I just close the Form that did open with this code and press the button5 again, I will have an Errormessage:
"Cannot access a disposed object. Object name: ´Form2´."
But if I change:
this->form2instance.Show();
to:
this->form2instance.ShowDialog();
Then it does work, I can open the Form2 and close it, open it again and so on.
The thing is that I need to use the code below because I will have to open many instances of the same Form.
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e)
{
this->form2instance.Show();
}