8. Form GantiPassword
Imports System.Data.OleDb
Public Class GantiPassword Private Sub TextBox1_KeyPressByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs Handles TextBox1.KeyPress If e.KeyChar = Chr13 Then
CMD = New OleDbCommandselect from Admin where Username= TextBox1.Text and IDPetugas = Home.Panel1.Text , CONN
DR = CMD.ExecuteReader DR.Read
If DR.HasRows Then TextBox2.Enabled = True
TextBox2.Focus Else
MsgBoxAnda tidak berhak mengganti password disini TextBox1.Focus
End If End If
End Sub
Private Sub TextBox2_KeyPressByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs Handles TextBox2.KeyPress
If e.KeyChar = Chr13 Then CMD = New OleDbCommandselect from Admin where Username=
Home.Panel2.Text and Password= TextBox2.Text , CONN DR = CMD.ExecuteReader
DR.Read If DR.HasRows Then
TextBox3.Enabled = True TextBox3.Focus
Else
Universitas Sumatra Utara
MsgBoxPassword lama salah TextBox2.Focus
End If End If
End Sub
Private Sub TextBox3_KeyPressByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs Handles TextBox3.KeyPress
If e.KeyChar = Chr13 Then If TextBox3.Text = Then
MsgBoxPassword baru wajib diisi TextBox3.Focus
Else TextBox4.Enabled = True
TextBox4.Focus End If
End If End Sub
Private Sub TextBox4_KeyPressByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs Handles TextBox4.KeyPress
If e.KeyChar = Chr13 Then If TextBox4.Text TextBox3.Text Then
MsgBoxPassword konfirmasi salah TextBox4.Focus
Else If
MessageBox.ShowYakin akan
ganti password?,
, MessageBoxButtons.YesNo = Windows.Forms.DialogResult.Yes Then
Dim update As String = Update Admin set [Password]= TextBox3.Text where [Username]= TextBox1.Text
CMD = New OleDbCommandupdate, CONN CMD.ExecuteNonQuery
Universitas Sumatra Utara
TextBox1.Clear TextBox2.Clear
TextBox3.Clear TextBox4.Clear
Login.Show Me.Close
Else TextBox1.Clear
TextBox2.Clear TextBox3.Clear
TextBox4.Clear Login.Show
Me.Close End If
End If End If
End Sub
Private Sub GantiPasswoDR_LoadByVal sender As System.Object, ByVal e As System.EventArgs Handles MyBase.Load
TextBox2.Enabled = False TextBox3.Enabled = False
TextBox4.Enabled = False End Sub
Private Sub BtnClose_ClickByVal sender As System.Object, ByVal e As System.EventArgs Handles BtnClose.Click
Home.Show Me.Hide
End Sub End Class
Universitas Sumatra Utara
9. Form LaporanTransaksi