Open same Form 2 Times

This is a discussion on Open same Form 2 Times within the C# Programming forums, part of the General Programming Boards category; I am trying to use a button to open 2 instances of the same Form wich meens that two windows/Forms ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    383

    Open same Form 2 Times

    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 ?


    Code:
    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();
     }

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    ShowDialog() opens the form as a modal (<--- there's your problem) dialog. Try calling Show() instead.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    383
    Yes, thanks that did work great...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how can I re-sort a map
    By indigo0086 in forum C++ Programming
    Replies: 8
    Last Post: 06-01-2006, 06:21 AM
  2. Fastest STL container?
    By Shakti in forum C++ Programming
    Replies: 18
    Last Post: 02-17-2006, 01:07 AM
  3. Way to get the current open programs displayed?
    By CPPguy1111 in forum C++ Programming
    Replies: 6
    Last Post: 06-22-2005, 12:24 AM
  4. Open files inside directory (UNIX platform)
    By swagatob in forum C Programming
    Replies: 15
    Last Post: 10-25-2004, 12:58 AM
  5. Big help in Astar search code...
    By alvifarooq in forum C++ Programming
    Replies: 6
    Last Post: 09-24-2004, 11:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21