Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If ComboBox1.Text = "" Then
MsgBox("Enter Must Be User Name")
Else
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\inventory\WindowsApplication1\inventory.mdb;")
cn.Open()
cmd = New OleDbCommand("select * from loginwindow", cn)
dr = cmd.ExecuteReader
While dr.Read
If ComboBox1.Items.Item(ComboBox1.SelectedIndex) = dr(1) Then
If TextBox1.Text <> dr(2) Then
MsgBox("Wrong Password Enter Right Password")
Else
Form1.Show()
Me.Hide()
End If
End If
End While
Catch ex As Exception
End Try
End If
Catch ex As Exception
End Try
cn.Close()
dr.Close()
End Sub
End Class