N. Duncan
N. Duncan

Reputation: 101

VB 2019 startup object default

Is there a way to change VB 2019 startup object DEFAULT from sub main to Form1? I'm a high school CS teacher switching from VB 2015 to 2019. My kids are entirely new to programming. I don't want them to have to go into Project settings to change the start up object every time they create a new program.

Upvotes: 0

Views: 484

Answers (1)

jmcilhinney
jmcilhinney

Reputation: 54487

It sounds like you have created a Windows Forms project that is targeting .NET 5. That will default to Sub Main as the startup object. .NET 5 is the latest and greatest but it is based on .NET Core rather than .NET Framework. As a result, there will be a number of subtle differences and a few things missing in relation to your coursework, which would have been written based on .NET Framework. Especially for beginners, I strongly recommend sticking with .NET Framework for Windows Forms apps for the time being.

In the New Project dialogue, all the project templates that target .NET Framework specifically say so. When you create a new Windows Forms project, be sure to select the template named "Windows Forms App (.NET Framework)" rather than the one named "Windows Forms App". The former will enable you to target .NET Framework 4.8 and earlier. That will behave exactly as you're used to from VS 2015. It's a good idea to type "framework" into the filter box on the New Project dialogue to be sure that you're selecting a .NET Framework project template.

Upvotes: 3

Related Questions