sakit sa ulo............ Imports System.Data.SqlClient Public - TopicsExpress



          

sakit sa ulo............ Imports System.Data.SqlClient Public Class frmStudentLogin Public userLogin As String Public userType As String Dim msg As String Dim time As Date Dim ctr As Integer Private Sub frmStudentLogin_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated flashLogin.Movie = Application.StartupPath & \Login.swf txtStudentID.Focus() chkAdminId.Checked = False createconn() End Sub Private Sub flashLogin_FSCommand(ByVal sender As Object, ByVal e As AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent) Handles flashLogin.FSCommand If emand = ButtonClick6 Then Try If chkAdminId.CheckState = CheckState.Checked Then If txtStudentID.Text = Then MsgBox(Please Input a Student Number, MsgBoxStyle.MsgBoxHelp, Login) Exit Sub End If conn.Open() command = New SqlCommand(select * from tbl_teacher where ID like % & txtStudentID.Text & , conn) dr = command.ExecuteReader While (dr.Read()) userLogin = (dr(FirstName)) & & (dr(LastName)) userType = (dr(UserType)) End While If dr.HasRows Then conn.Close() If userType = Admin Then frmLoading.flashMain.Movie = Application.StartupPath & \admin.swf msg = Admin Login to System ElseIf userType = Teacher Then frmLoading.flashMain.Movie = Application.StartupPath & \teacher1.swf msg = Teacher Login to System End If time = Now conn.Open() command = New SqlCommand(insert into tbl_audit (Audit_User,Audit_Time,Audit_Activity) values ( & userLogin & , & time & , & msg & ), conn) command.ExecuteNonQuery() flashWelcome.Movie = Application.StartupPath & \welcome.swf MsgBox(Welcome & userLogin, vbInformation, Login) frmLoading.Show() conn.Close() flashWelcome.Movie = Application.StartupPath & \main_form.swf Me.Hide() Else ctr = ctr + 1 MsgBox(Login Failed, vbCritical, Login) conn.Close() End If Else If txtStudentID.Text = Then MsgBox(Please Input a Student Number, MsgBoxStyle.MsgBoxHelp, Login) Exit Sub End If conn.Open() command = New SqlCommand(select * from tbl_student where Student_ID like % & txtStudentID.Text & , conn) dr = command.ExecuteReader While (dr.Read()) userLogin = (dr(FirstName)) & & (dr(LastName)) End While If dr.HasRows Then flashWelcome.Movie = Application.StartupPath & \welcome.swf MsgBox(Welcome & userLogin, vbInformation, Login) frmLoading.flashMain.Movie = Application.StartupPath & \main_form.swf frmLoading.flashMusic.Movie = Application.StartupPath & \mainsound2.swf frmLoading.Show() conn.Close() flashWelcome.Movie = Application.StartupPath & \main_form.swf Me.Hide() Else ctr = ctr + 1 MsgBox(Login Failed, vbCritical, Login) conn.Close() End If End If Catch ex As Exception MsgBox(ex.ToString) End Try If ctr = 3 Then MsgBox(System will shutdown) End End If txtStudentID.Text = End If If emand = ButtonClick7 Then frmMain.Show() Me.Hide() End If If emand = ButtonClick2 Then frmStudentRegister.Show() Me.Hide() End If If emand = ButtonClick3 Then frmStudentMaintenance.Show() Me.Hide() End If If emand = ButtonClick4 Then frmAdminTeacherRegister.Show() Me.Hide() End If If emand = ButtonClick5 Then frmAdminTeacherMaintenance.Show() Me.Hide() End If End Sub Private Sub txtStudentID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStudentID.KeyPress If (Microsoft.VisualBasic.Asc(e.KeyChar) < 47) Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 57) Then If (Microsoft.VisualBasic.Asc(e.KeyChar) 32) Then e.Handled = True End If If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then e.Handled = False ElseIf (Microsoft.VisualBasic.Asc(e.KeyChar) = 46) And ctr < 1 Then e.Handled = False ctr = ctr + 1 ElseIf (Microsoft.VisualBasic.Asc(e.KeyChar) = 32) Then ctr = 0 End If End If End Sub Private Sub chkAdminId_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAdminId.CheckedChanged If chkAdminId.Checked = True Then txtStudentID.PasswordChar = * Else txtStudentID.PasswordChar = End If End Sub End Classified
Posted on: Sun, 23 Mar 2014 18:59:35 +0000

Trending Topics



Recently Viewed Topics




© 2015