Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get my VB.NET forms application startup method to be Sub Main() in Program.vb?

Trying to get it to behave like C#, where there is a Program class with a static Main method.

However, in the project properties, I cannot set Program.vb to be the startup object, only the forms (it is a forms application).

Am I missing something?

I am using the VS2010 and the latest VB.

like image 914
NibblyPig Avatar asked May 17 '10 14:05

NibblyPig


2 Answers

Uncheck Enable Application Framework in Project Properties.

like image 57
SLaks Avatar answered Sep 29 '22 14:09

SLaks


You need to switch off “Application Framework” on the main page of the project settings.

The application framework provides its own entry point which sets up a few things that are subsequently used (e.g. application events, single instance checks etc.) and then just displays the main form using System.Windows.Forms.Application.Run. That’s why you can only supply the main form, not a custom entry point method.

like image 42
Konrad Rudolph Avatar answered Sep 29 '22 14:09

Konrad Rudolph