none
Show windows forms when i build my program C# and set breakpoint

    Question

  • I have a problem. Im pretty new on this. I have done som different forms in visual studio and C#. When i build my program the form who is connected to the Main method is coming up. How do I do if I have done a lot of code in other forms and want to build and test them (F5). And how do I do for example when I set a breakpoint in the other forms so that the breakpoint show the form I´m working in and not the Main form? Pls help me:) 
    Friday, April 7, 2017 10:46 AM

Answers

  • Every time you start debugging set the form you are working on as the launching form in the main method. this will work in case if you don't have a dependency of any kind related to the process of your application. 

    private static void Main(string[] args)
    {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.SetCompatibleTextRenderingDefault(false); 
    MainForm mf = new MainForm(); 
    //Form1 mf = new Form1();
    //Form2 mf = new Form2();
    Application.Run(mf);
    //
    }


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     


    Friday, April 7, 2017 11:13 AM

All replies

  • Every time you start debugging set the form you are working on as the launching form in the main method. this will work in case if you don't have a dependency of any kind related to the process of your application. 

    private static void Main(string[] args)
    {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.SetCompatibleTextRenderingDefault(false); 
    MainForm mf = new MainForm(); 
    //Form1 mf = new Form1();
    //Form2 mf = new Form2();
    Application.Run(mf);
    //
    }


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     


    Friday, April 7, 2017 11:13 AM
  • thank you! now it´s working!
    Friday, April 7, 2017 11:33 AM
  • Please mark as Answer :)

    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     

    Friday, April 7, 2017 11:42 AM