Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub txtUsername_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtUsername.KeyPress
- 'tampung hasil query ke datatable
- Dim DT As New DataTable
- Using con As New MySqlConnection("server=localhost;database=tes;uid=root;pwd=root;")
- Using adp As New MySqlDataAdapter("Select username, password From Login", con)
- Try
- adp.Fill(DT)
- Catch ex As Exception
- MsgBox(ex.ToString)
- Exit Sub
- End Try
- End Using
- End Using
- 'validasi jika user menekan tombol enter di textbox username
- If e.KeyChar = Chr(13) Then
- If txtUsername.Text = "" Then
- MsgBox("Masukan username anda", vbInformation, "Kesalahan")
- txtUsername.Focus()
- Else
- 'filter/seleksi datatable
- If DT.Select("username='" & txtUsername.Text & "' ").Count > 0 Then
- txtPassword.Focus()
- Else
- MsgBox("Username tidak ditemukan", vbInformation, "Kesalahan")
- txtUsername.Focus()
- End If
- End If
- End If
- End Sub
Add Comment
Please, Sign In to add comment