|
-
May 29th, 2002, 05:58 PM
#1
Thread Starter
Registered User
sub main in vb.net, where are you
i just started vb.net
i made two forms and that is about it. All i want to know is how to create some main sub where you call the first form. Every time i hit play, the program just loads the first form i made. I tried adding a module and Sub Main like in vb 6 but that doesn't work...i am lost.
jeff
-
May 29th, 2002, 08:18 PM
#2
Addicted Member
You add a module to the project. Then add a sub main to the module.
'The program entry point
Public Sub Main()
Dim frmMain As New frm_main()
Application.Run(frmMain) 'Continue
End Sub
NEXT - You need to set the Startup Object
In the solution explorer - right click the project and select properties. Set the Startup object to sub main.
Goodluck
-
May 30th, 2002, 08:01 AM
#3
Main() doesn't have to be in a module. You could just throw it in one of the forms:
Code:
Public Shared Sub Main()
'Your code goes here
End Sub
Note that VB.NET will not automatically create an instance of the form for you once you put Sub Main in it. You will have to create it yourself.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|