Close Login Form while loading MDI Form

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
Hi,
I am facing small problem in vb.net 2005 window application... i have a login form which is my startup form too, when i submit proper credentials i want to open my MDI parent form and in the mean time i want my Login form to close..
i tried different methods but nothing seems to be working..

Dim mdi As New Mdiformname
mdi.Show() //loading Mdi Form
Me.Close() // Close Login Form
Me.Dispose() //Alternative method i used

can anybody guide me in this regard

Regards
Praveen
 
Set the main form as startup form. In Application Startup event you show the login form as dialog and use e.Cancel to stop application from starting if login fails.
 
VB.NET:
Expand Collapse Copy
Private Sub MyApplication_Startup(ByVal sender As Object, _
   ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
       If loginform.ShowDialog <> DialogResult.OK Then e.Cancel = True
End Sub
You get to the Application Events from main menu Project Properties, Application tab, click "View Application Events" button.
In Login form you set DialogResult=OK if login is ok.
 
Thank U John

hi,
I solved it.. thanks for your timely respose... this forum is known for its quick response.. thaats why i always depend on this forum for my queries..

thanks and regards
Praveen
 
Back
Top