User controls

Hello,

I have more than one user controls in my project. However, when I add the new one and re-run the project, the newest user control will be running, not the one I want to be run. How can I set default for the user control I want it to run when I run my project

Thanks,

Tammy



Answer this question

User controls

  • JeffK_

    Hi, Tammy,

    not sure what you mean by running a user control. User controls are usually put on a form (dragged from the toolbox). If you want to change which *form* should display when you run your project (startup form), open your program.cs file and replace the name of the form in the following line:

    Application.Run(new Form1())

    to, let's say:

    Application.Run(new Form2())

    Andrej



  • qrli

    I have the main form, and user controls are put on the main form. When application runs, the main form doesn't show up but the newest user control shows up instead of main form.

    where should I put the application.run ...

    Thanks,

    Tammy


  • nub340

    Application.Run should be in your program.cs file (generated for you when you create a new C# project).

    Andrej



  • User controls