Nah sekarang anda bisa membuat Form seperti gambar diatas. dan Codingnya seperti dibawah ini :
Private Sub Command1_Click()
If Text4 <> Text3 Then
MsgBox "password konfirmasi tidak sama"
Text4.SetFocus
Text4 = ""
Else
Pesan = MsgBox("yakin password akan diganti", vbYesNo)
If Pesan = vbYes Then
Dim editpwd As String
editpwd = "update admin set passworduser='" & Text4 & "' where kodeuser='" & Text1 & "' and passworduser='" & Text2 & "'"
koneksi.Execute editpwd
Unload Me
Else
Unload Me
End If
End If
End Sub
Sub Form_Load()
Call BukaDB
Text1.MaxLength = 6
Text2.MaxLength = 15
Text3.MaxLength = 15
Text2.PasswordChar = "X"
Text3.PasswordChar = "X"
Text4.PasswordChar = "X"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Call BukaDB
RSuser.Open "select * from admin where kodeuser='" & Text1 & "'", koneksi
If Not RSuser.EOF Then
Text2.SetFocus
Else
MsgBox "Kode user salah "
Text1.SetFocus
Text1 = ""
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Call BukaDB
RSuser.Open "select * from admin where kodeuser='" & Text1 & "' and passworduser='" & Text2 & "'", koneksi
If Not RSuser.EOF Then
Text3.SetFocus
Else
MsgBox "password lama salah "
Text2.SetFocus
Text2 = ""
End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
If Text3 = "" Then
MsgBox "password baru belum dibuat"
Text3.SetFocus
Else
Text4.SetFocus
End If
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Gampang bukan? Semoga bermanfaat yagh..
Jika anda belum bisa juga anda bisa langsung download dibawah ini :
DOWNLOAD
Silahkan kunjungi Kumpulan Tutorial Lengkap VB Dengan KLIK LINK INI
bagai mana cara gabung belajar online vB, apakah masih di buka. saya sangat berminat
ReplyDeleteThis comment has been removed by a blog administrator.
Deletesaya mau nanya "Call BukaDB" itu maksudnya apa?
ReplyDeletePanggil Database
Deletegan..pny ane ko' pas ketika akan mengeksekusi koneksi.execute editpwd nya error ya.. katanya syntax error in update statment padal dh bner smua...
ReplyDelete
DeleteIf MessageBox.Show("Ganti Password.... ?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Dim editpwd As String
editpwd = "update mahasiswa set pass_mhs='" & TextBox3.Text & "' where nim='" & LoginMhs.TextBoxNIM.Text & "' and pass_mhs='" & TextBox1.Text & "'"
CMD = New OdbcCommand(editpwd, Conn)
CMD.ExecuteNonQuery()
Call Bersih()
Else
Call Bersih()
Nabilah itu dimasukan dibagian mananya, dibawah koneksi.execute apa diatas,..
Deletesama, syntax error in update statement. mohon solusinya.
Deleteudah berhasil... tanks ilmunya
ReplyDelete