Open same Form 2 Times [Archive] - C Board

PDA

View Full Version : Open same Form 2 Times


Coding
03-25-2008, 04:28 PM
I am trying to use a button to open 2 instances of the same Form wich meens that two windows/Forms actully will open of the same Form.

I have created 2 instances like this where I try to open 2 at the same time with the button2_Click_3 below but I cant figure out what I could be doing wrong.

What happens is that, First form21instance do opens and then when I close this instance, form22instance is opened.
What I want is that the Form opens twice.
Any idéas what this could depend on ?



public ref class Form3 : public System::Windows::Forms::Form
{
private: Form2 form21instance;
private: Form2 form22instance;
}

private: System::Void button2_Click_3(System::Object^ sender, System::EventArgs^ e)
{
this->form21instance.ShowDialog();
this->form22instance.ShowDialog();
}

Magos
03-26-2008, 01:01 AM
ShowDialog() opens the form as a modal (<--- there's your problem) dialog. Try calling Show() instead.

Coding
03-29-2008, 12:55 PM
Yes, thanks that did work great...