Sub Main

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
I can add a Sub Main to a module as a start point for the application, as I would have done in VB6, but I can't figure out how to specify that this is where the application is to start. The listbox under Application Properties/Application/StartUp Form only allows me to select forms. So how do I do this?
 
If you want to start from Sub Main

Click on Project, drag and click onto Properties
Under 'Common Properties' ---> 'General'

There is a list box under 'Startup Object'
Drag to 'Sub Main'
 
techmanbd said:
If you want to start from Sub Main

Click on Project, drag and click onto Properties
Under 'Common Properties' ---> 'General'

There is a list box under 'Startup Object'
Drag to 'Sub Main'
Attached is what my screen looks like. Unfortunately, I can't tie in what you're saying with that at all. Under WindowsApplication1 I can get a Properties menu item, clicking on that shows me the properties as displayed in the attachment. That has a Startup form dropdown but this only allows forms to be selected, not Sub Main.

I have 2005 Express Version, you probably have a different one.
 

Attachments

Last edited by a moderator:
Yeah I have 2003. So couldn't tell you in 2005 express. I am going to have to download it when I get home for my home computer.

So where it says startup form, I take it there isn't an option to start at 'Sub Main'?
 
techmanbd said:
Yeah I have 2003. So couldn't tell you in 2005 express. I am going to have to download it when I get home for my home computer.

So where it says startup form, I take it there isn't an option to start at 'Sub Main'?
Nope. The help file says in relation to Sub Main:
Windows Forms applications run on their own. However, the Visual Basic compiler automatically generates a Main procedure in such an application, and you do not need to write one.
I've looked everywhere including Application.Designer and Form1.Designer and there's no sign of an automatically generated Sub Main. And the help file doesn't tell you how to specify that you want to use one to start the application.
 
You have to uncheck "Enable Application Framework" and then the startup form combobox becomes a startup object box, from which you can choose Sub Main.
 
Back
Top