How can I get the VB.NET form application launch method to be Sub Main () in Program.vb?

Trying to make it behave like C # where there is a program class with a static main method.

However, in the project properties, I cannot set Program.vb as a launch object, only forms (this is a form application).

Did I miss something?

I am using VS2010 and the latest VB.

+4
source share
2 answers

Uncheck the Enable Application Framework checkbox in the project properties.

+7
source

You need to disable the "Application Framework" on the project settings main page.

The application structure provides its own entry point, which sets up several things that are subsequently used (for example, application events, individual instance checks, etc.), and then simply displays the main form using System.Windows.Forms.Application.Run . This is why you can only provide the main form, not the custom entry point method.

+2
source

Source: https://habr.com/ru/post/1309993/


All Articles