Opening Another Form


Well-known member
Apr 6, 2005
Programming Experience
This is my code:

Dim oForm As New frmLogin

The problem is, when 'Me.Close()' is executed, frmLogin is also closed. How should I open another form, and then close the current form actually...

Thank you for helping.
what you will want to do is add a module to the project and in this module you'll want:

Friend LoginForm as frmLogin

'Main Form
LoginForm = New frmLogin
If Me is the startup object for your application then closing it will exit your app. If I'm not mistaken .NET 2.0 allows you to choose whether your app exits when the main form closes or when all forms close, but for now I think you will have to choose a new startup object. You can create a class with a Main procedure to open your forms.

First off, JuggaloBrotha gave you good suggestion ... but i guess it was a bit confusing for you beside the fact it's so simple ... trust me.
btw, do you want to have a splash screen, login Form ... or simply close the form and open new one ... then, take a look at this example
Cheers ;)


    27.6 KB · Views: 202
yea, i did neglect the fact that Form1 was the startup object instead of using Sub Main

i didnt follow up on that either, there's tons of multiple forms threads on here as it is ;)
The starting point is Sub Main(), in which I wrote:

If isAlreadyRegistered() Then
'check whether valid version or not. If ok, runn app... if not check demo validity, if demo expired, terminate function
Select Case isValidApp()
Case True
isDemoMode = False
Application.Run(New frmLogin)
Case False
If CheckDemoValidity() Then
Application.Run(New frmDemoStartScreen) 'run demo start screen
isDemoExpired = True
Application.Run(New frmDenial) 'run denial screen then end
End If
End Select
Application.Run(New frmRegistration) 'run registration screen
End If

I'll try the codes listed above. Thank you so much for helping.
Thank you everybody for your help...

I just had the opportunity to go through the codes Kulrom to put in my new project. It was so easy if only I knew how to do it the correct way... and it is not the only thing I learned. I saw you using:

Previously, I used 'End' to end my application and I feel like it takes around one or two seconds before it actually closes the application.

once again... thank you for helping and increasing my programming experience