How to run two windows form at the same time.. C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kosaks
    New Member
    • May 2010
    • 10

    How to run two windows form at the same time.. C#

    How can i run two windows form at the same time?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    May I suggest picking up a basic C# introductory book? It's not that people here don't want to be helpful, but there is a certain amount of basic learning work that one should really take upon themselves before asking for help. There are so many great "How do I build my first application" tutorials on the web... There are dozens of "Learn C# in 21 days", "My first C# program" books at your look book seller or even public library... Asking a forum, any forum, to hand-hold you through it is just redundant. In many ways it disrespects the people who have invested dozens of hours in the on-line tutorials and those that spent thousands of hours in authoring books.

    Build a Program Now! in Visual C# by Microsoft Press, ISBN 0-7356-2542-5
    is a terrific book that has you build a Windows Forms application, a WPF app, a database application, your own web browser.

    C# Cookbooks
    Are a great place to get good code, broken down by need, written by coding professionals. You can use the code as-is, but take the time to actually study it. These professionals write in a certain style for a reason developed by years of experience and heartache.

    Microsoft Visual Studio Tip, 251 ways to improve your productivity, Microsoft press, ISBN 0-7356-2640-5
    Has many, many great, real-world tips that I use all the time.

    The tutorials below walk through making an application including inheritance, custom events and custom controls.
    Building an application Part 1
    Building an application part 2

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      And to show we are not completely heartless... The answer to your question.

      You just make two instances of your forms and show them.

      Two instances of the same form.
      Code:
      Form1 myFirstForm = new Form1();
      Form1 mySecondForm = new Form2();
      myFirstForm.Show();
      mySecondForm.Show();
      One instance each of two different forms
      Code:
      Form1 myFirstForm = new Form1();
      Form2 mySecondForm = new Form2();
      myFirstForm.Show();
      mySecondForm.Show();

      Comment

      • kosaks
        New Member
        • May 2010
        • 10

        #4
        Thank you so much sir. I am new to programming. And also thank you for giving me a very help links to study C#.

        Comment

        • bitsetter
          New Member
          • Oct 2014
          • 1

          #5
          Oops!

          Originally posted by tlhintoq
          And to show we are not completely heartless... The answer to your question.

          You just make two instances of your forms and show them.

          Two instances of the same form.
          Code:
          Form1 myFirstForm = new Form1();
          Form1 mySecondForm = new Form2();
          myFirstForm.Show();
          mySecondForm.Show();
          One instance each of two different forms
          Code:
          Form1 myFirstForm = new Form1();
          Form2 mySecondForm = new Form2();
          myFirstForm.Show();
          mySecondForm.Show();
          Uh, should not two instances of the same form look like this instead?
          Form1 myFirstForm = new Form1();
          Form1 mySecondForm = new Form1();

          Comment

          Working...