User controls  
Author Message
Tammt





PostPosted: Visual C# General, User controls Top

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



Visual C#18  
 
 
Andrej Tozon





PostPosted: Visual C# General, User controls Top

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



 
 
Tammt





PostPosted: Visual C# General, User controls Top

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


 
 
Andrej Tozon





PostPosted: Visual C# General, User controls Top

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

Andrej