Private Sub loginbtn_Click_1(sender As System.Object, e As System.EventArgs) Handles loginbtn.Click For Each ctrl As Control In Me.Controls If (usernametxt.Text & passwordtxt.Text = String.Empty) Then ErrorProvider1.SetError(usernametxt, "Incorrect") ErrorProvider2.SetError(passwordtxt, "Incorrect") MsgBox("Fill The Details", MsgBoxStyle.Exclamation) Exit Sub End If Next con.Open() l = "Select username, password, type From Login where username='" & usernametxt.Text & "' and password='" & passwordtxt.Text & "'" com = New SqlCommand(l, con) dr = com.ExecuteReader dr.Read() If usernametxt.Text = dr.GetString(0) Then If passwordtxt.Text = dr.GetString(1) Then If dr.GetString(2) = "ADMIN" Then Me.Hide() HomePage.Show() ElseIf dr.GetString(2) = "EMPLOYEE" Then Me.Hide() HomePage.Show() StudentReg.editbtn.Enabled = False StudentReg.removebtn.Enabled = False StaffReg.editbtn.Enabled = False StaffReg.removebtn.Enabled = False HomePage.CourseFeesToolStripMenuItem.Enabled = False HomePage.BatchesToolStripMenuItem.Enabled = False HomePage.EventsToolStripMenuItem.Enabled = False Billing.Button1.Enabled = False HomePage.ReportsToolStripMenuItem.Enabled = False End If End If Else MsgBox("Please Enter Correct Username And Password", MsgBoxStyle.Critical) End If usernametxt.Text = "" passwordtxt.Text = "" con.Close() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)