Kodingan Menu Login
Full Kodingan Menu Login
Imports
System.Data.OleDb
Public Class Formlogin
Private Sub Formlogin_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load
Call Buka_Koneksi()
End Sub
Private Sub cmdexit_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
cmdexit.Click
Dim
Pesan As String
Pesan = MessageBox.Show("Wanna exit system?", "Conformation", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)
If
Pesan = vbOK Then Me.Close()
End Sub
Private Sub txtuser_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtuser.KeyPress
If
e.KeyChar = Chr(13) Then txtpasswd.Focus()
End Sub
Private Sub txtpasswd_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtpasswd.KeyPress
If
e.KeyChar = Chr(13) Then cmdlogin.Focus()
End Sub
Private Sub cmdlogin_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
cmdlogin.Click
Dim
username As String
= txtuser.Text
Dim
password As String
= txtpasswd.Text
Dim sql
As String = "select * from login where username='"
& txtuser.Text & "' and passwd='"
& txtpasswd.Text & "'"
Dim Cmd
As New OleDbCommand(sql, Conn)
Dim
RS_Login As OleDbDataReader
= Cmd.ExecuteReader
If
RS_Login.HasRows Then
MessageBox.Show("Login Sukses", "Informasi",
MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
Me.Hide()
menuutama.Show()
Else
MessageBox.Show("Login Gagal", "Peringatan",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End If
End Sub
Private Sub GroupBox2_Enter(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
GroupBox2.Enter
End Sub
End Class
0 komentar:
Post a Comment