Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data.Odbc
- Public Class Login
- Dim hitung As Integer
- Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Call koneksi()
- cmd = New OdbcCommand("select * from user where id_user='" & TextBox1.Text & "' and password_user='" & TextBox2.Text & "' and status_user='" & ComboBox1.Text & "'", conn)
- dr = cmd.ExecuteReader
- dr.Read()
- If dr.HasRows Then
- '=========================
- If TextBox2.Text <> dr("password_user") Then
- MsgBox("Password Salah")
- TextBox2.Focus()
- Exit Sub
- End If
- '===================
- TextBox1.Clear()
- TextBox2.Clear()
- ComboBox1.Text = ""
- TextBox1.Focus()
- Me.Visible = False
- menuutama.Show()
- '======================================================== logger
- menuutama.PanelKode.Text = dr("id_user")
- menuutama.PanelNama.Text = dr("nama_user")
- menuutama.PanelStatus.Text = UCase(dr("status_user"))
- '=============================================== hak akses
- If menuutama.PanelStatus.Text <> "ADMIN" Then
- menuutama.UserToolStripMenuItem.Visible = False
- menuutama.Button1.Visible = False
- Else
- menuutama.UserToolStripMenuItem.Visible = True
- menuutama.Button1.Visible = True
- End If
- Else
- MsgBox("Login Gagal")
- TextBox1.Clear()
- TextBox2.Clear()
- ComboBox1.Text = ""
- TextBox1.Focus()
- hitung = hitung + 1
- If hitung = 3 Then
- End
- Me.Close()
- End If
- End If
- End Sub
- Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Me.Close()
- End Sub
- Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.CenterToScreen()
- TextBox2.PasswordChar = "*"
- Call tampil_status()
- End Sub
- Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
- If e.KeyChar = Chr(13) Then
- Button1.Focus()
- End If
- End Sub
- Sub tampil_status()
- 'nampilin status combobox dinamis
- Call koneksi()
- cmd = New OdbcCommand("select distinct status_user from user", conn)
- dr = cmd.ExecuteReader
- ComboBox1.Items.Clear()
- Do While dr.Read
- ComboBox1.Items.Add(dr.Item("status_user"))
- Loop
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement