Public Class Frm01Login
Inherits System.Windows.Forms.Form
Dim dat_user As SqlClient.SqlDataAdapter
Private Sub Frm01Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TxtUsername.Text = ""
Me.TxtPass.Text = ""
End Sub
'Dim utama As New frm02utama
Private Sub BtnLogin_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin.Click
Try
If Me.TxtUsername.Text = "" Then
MsgBox("User name harus diisi, masukan input yang tepat", MsgBoxStyle.Critical, "Kesalahan")
Me.TxtUsername.Focus()
Exit Sub
Exit Sub
ElseIf Me.TxtPass.Text = "" Then
MsgBox("Password harus diisi, masukan input yang tepat", MsgBoxStyle.Critical, "Kesalahan")
Me.TxtUsername.Focus()
Exit Sub
End If
dat_user = New SqlClient.SqlDataAdapter("select * from t_login where username = '" & Me.TxtUsername.Text & "' and password ='" & Me.TxtPass.Text & "'", modumum.koneksi)
Dim dtt_user As New DataTable
dtt_user.Clear()
dat_user.Fill(dtt_user)
If dtt_user.Rows.Count = Nothing Then
MsgBox("User ID atau Password anda salah, masukan input yang tepat", MsgBoxStyle.Information, "Informasi")
Me.TxtUsername.Clear()
Me.TxtUsername.Focus()
Me.TxtPass.Clear()
Exit Sub
Else
Me.GrpBxLogin.Visible = False
Me.GrpBxPengaman.Visible = True
Me.BtnLogin.Visible = False
Me.BtnLogin1.Visible = True
End If
'Me.Close()
Catch ex As Exception
' MsgBox(ex.Message, MsgBoxStyle.Information, "Kesalahan")
End Try
End Sub
Private Sub BtnLogin1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin1.Click
Dim no As String
no = Val(Me.txtAngka.Text) + 1
Me.txtAngka.Text = no
If no > 3 Then
MsgBox("Maaf, apakah anda lupa password anda?", MsgBoxStyle.Information, "Perhatian")
Me.GrpBxPengaman.Visible = False
Me.GrpBxLogin.Visible = True
Me.TxtPass.Text = ""
Me.TxtUsername.Text = ""
Me.txtAngka.Text = ""
End If
Try
If Me.TxtSandi.Text = "" Then
MsgBox("Maaf, sandi pengaman belum anda isi", MsgBoxStyle.Critical, "Kesalahan")
Me.TxtSandi.Focus()
Exit Sub
Else
dat_user = New SqlClient.SqlDataAdapter("select pengaman from t_login where username = '" & Me.TxtUsername.Text & "' and password ='" & Me.TxtPass.Text & "' and pengaman ='" & Me.TxtSandi.Text & "'", modumum.koneksi)
Dim dtt_user As New DataTable
dtt_user.Clear()
dat_user.Fill(dtt_user)
If dtt_user.Rows.Count = Nothing Then
MsgBox("Maaf, sandi pengaman yang anda masukkan salah", MsgBoxStyle.Information, "Informasi")
Me.TxtSandi.Clear()
Me.TxtSandi.Focus()
Exit Sub
Else
Me.Hide()
Frm02Utama.Show()
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Kesalahan")
End Try
End Sub
End Class
Rabu, 23 Maret 2011
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar