Submitted by: Submitted by otnavitna
Views: 1077
Words: 10844
Pages: 44
Category: Other Topics
Date Submitted: 10/20/2012 02:10 AM
Form1 Form
Public Class Form1
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
Dim Row As DataRow
For Each Row In Me.PassDataSet.tbpass
If (Row.Item("Username") = ComboBox1.Text) Then
If (Row.Item("Password") = Me.txtpassword.Text) Then
mainmenu.bAccess = True
ComboBox1.Text = ""
ComboBox1.Enabled = True
txtpassword.Enabled = True
ComboBox1.Focus()
Me.Close()
Else
MsgBox("Code did not match to the current record! Click 'OK' to retry.", MsgBoxStyle.Critical, "ERROR")
ComboBox1.Text = ""
txtpassword.Text = ""
ComboBox1.Enabled = True
txtpassword.Enabled = True
ComboBox1.Focus()
End If
End If
Next
End Sub
Private Sub btncan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncan.Click
Me.Close()
End Sub
Private Sub txtpassword_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpassword.KeyPress
If e.KeyChar = Chr(13) Then
btnlogin_Click(sender, e)
End If
End Sub
Private Sub txtpassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtpassword.TextChanged
Dim Row As DataRow
For Each Row In Me.PassDataSet.tbpass
If (Row.Item("Password") = Me.txtpassword.Text) Then
txtpassword.Enabled = False
End If
Next
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim Row As DataRow
For Each Row In Me.PassDataSet.tbpass
If (Row.Item("username") = Me.ComboBox1.Text) Then
ComboBox1.Enabled = False
End If
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'PassDataSet.tbpass' table. You can move, or remove it, as needed.
Me.TbpassTableAdapter.Fill(Me.PassDataSet.tbpass)
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)...