Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All,

I have a login form and after authenticationm when I click on OK, it should open my Main form(which is a MDIParent). I tried in all possible ways but am unable to do that. Can anyone help me with this?

VB
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        Try
            Dim AuthData As New GetData.GetData()
            Dim DT As DataTable = AuthData.GetAuthentication(UsernameTextBox.Text, PasswordTextBox.Text)
            Dim Password As String = DT.Rows(0).Item(0).ToString
            If (Password = PasswordTextBox.Text) Then
                MsgBox("Login Successful")
                Me.Close()
                MainForm.Show()
            Else
                MsgBox("Invalid Password. Please Try Again")
            End If
        Catch EX As Exception
            MsgBox("UserName Not Registered. Please enter a Valid Username and Continue")
        End Try
    End Sub


MainForm is a MDI Container which i am trying to open after successful login.
Please Help Me.
Posted

1 solution

Go to project properties and check under application tab what is set as Startup form and Shutdown mode. If it is set to When startup form closes, your application will end when you close the login form.
 
Share this answer
 
Comments
Vamshi Krishna Naidu 12-Sep-11 5:33am    
That I got it. But how to open the MdiContainer if the loginform Closes? My MDI Container(mainform) still doesn't open when i close the login form.
Prerak Patel 12-Sep-11 5:57am    
Set Shutdown mode to When last form closes. and put MainForm.Show() before Me.Close()
Vamshi Krishna Naidu 12-Sep-11 6:01am    
you are awsome. it worked like a charm.
Prerak Patel 12-Sep-11 6:02am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900