A C # console project has been created that contains the console class (program.cs). I added a form (Main.cs) to the project.
I want to do one of the following things with my project 1. Change the project to a Windows Form application , can I change it to a Windows Form application without creating a new project. 2. Set the Main class as the launch object . Check the "Application" tab in the properties window. The main class is not included in the list of Startup objects.
What you should do:
Main(), :
[STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new YourMainForm()); }
"YourMainForm" . Main() - , , , . Run(), , .
Console Application Windows Application.
Console Application
Windows Application
Windows Form → "" → " " " Windows".
Set the Main class as a launch object You do not need to install the launch object if you have only one class containing the static Main () method. To start a Windows application, you need to implement the Main method containing the call Application.Run(). You can create a Windows forms project using the new project wizard to see an example.
Application.Run()
Source: https://habr.com/ru/post/1772686/More articles:C # CGI executables - good or bad idea? - httpTDD с MS Test - c#How can I center the tooltip above my control in Silverlight? - tooltipWhy does UIWebView consume so much memory? - memoryDateFormatter that's not picky? - javaJUnit Test Proposal - unit-testingUsing fancybox on a loaded AJAX page - jqueryКак объявить класс динамически? С# - reflectionEclipse IDE проблема "не win32-приложение" - eclipseJava Creates a new Map.Entry array - javaAll Articles