Hi,
I have awindows project developed in vs2008.I have to login to show the Mdi form of the project.
I have kept the starting point of my project to Login.vb page.
Here i enter userid and password andlogin.
After successful login i have to show the Mdi form.
Dim sUserName As String, sPassword As String, pstatus As String
Dim nUserID As Integer, nUsername As String
//creating the mdi here
Dim mdiform As New MDIparent()
Dim cnn As SqlClient.SqlConnection = New SqlClient.SqlConnection(My.Settings.connectionstring)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
Dim dt As New DataTable, strSQL As String
Try
sUserName = txtUserName.Text.Trim
sPassword = txtPassword.Text.Trim
If sUserName.Length = 0 Then
MsgBox("You must enter a user name")
txtUserName.Focus()
ElseIf sPassword.Length = 0 Then
MsgBox("You must enter a password")
txtPassword.Focus()
End If
//code for login goes here
If pstatus = True Then
txtUserName.Focus()
Else
My.Settings.UserID = nUserID
My.Settings.Username = sUserName
mdiform.Show()
Me.Close()
End If
Else
MsgBox("Invalid username or password. Please try again")
txtUserName.Focus()
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Login Error")
txtUserName.Focus()
End Try
txtUserName.Text = ""
txtPassword.Text = ""
End Sub
Once ilogin using the login credentials i have to close the login form and show the mdi parent. But the applicationwill quit once it is logged in.
Any suggestions.