Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am a VB6 programmer who is trying to make the move to VB .NET. I have a question. In VB6, you could have a start your app from Sub Main() and then launch a form, or an instance of it.

Sub Main()
    Dim frm as Form1
    frm = New Form1
    Load frm: frm.Show
End Sub

This would automatically start the form when the app starts.

 

In VB.NET, I am doing a similar thing:

 

Module Startup
    Sub Main()
         Dim frm as New Form1
         frm.show()
    End Sub
End Module

I would think that the form would stay open even when the program leaves Main(), but it doesn't. The only way I could keep it open was to use .ShowDialog.

How can I do the .NET equivilent of my VB6 Sub Main()??

"For every complex problem, there is a solution that is simple, neat, and wrong." - H. L. Mencken
  • 3 weeks later...
Posted

Set The Entry Point For The Project

 

If you open the Solution Explorer in VB.NET, then right mouse click upon the Project Name, and select properties.

 

From the Project Properties window select the Startup Object pulldown menu and then select the form use wish to execute when the Project starts, this does away with writing code to start the form and the form will remain open.

 

Hope this helps.

 

Jon.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...