Вы находитесь на странице: 1из 49

Imports System.Data.

OleDb
Public Class LoginForm
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnCancel.Click
If MsgBox("Are you sure you want
to close?", MsgBoxStyle.YesNo, "Close
Window") = MsgBoxResult.Yes Then
End
End If
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnSignUp.Click
StudentInformation.Show()
AutoNo()
End Sub
Sub AutoNo()
Try
sql = "SELECT A_ReviewerID
FROM tblStudentInfo Order By
A_ReviewerID desc"
ConnectDB()
cmd = New
OleDbCommand(sql, con)

dr =
cmd.ExecuteReader(CommandBehavio
r.CloseConnection)
If dr.Read = True Then
StudentInformation.txtID.Text =
Val(dr(0)) + 1
Else
StudentInformation.txtID.Text = 10001
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub Login()
'Try
'sql = "SELECT * FROM
tblStudentInfo WHERE A_Usertype = '"
& cbotype.Text & "' AND A_Username
= '" & txtUser.Text & "' AND A_Pass =
'" & txtPass.Text & "'"
ConnectDB()
'cmd = New OleDbCommand(sql,
con)
'dr =
cmd.ExecuteReader(CommandBehavio
r.CloseConnection)
'If dr.Read = True Then

' If cbotype.Text = "Reviewer"


Then
'
MainForm.
' End If
' MainForm.txtid.Text =
txtUser.Text
' txtUser.Text = ""
' txtPass.Text = ""
' Me.Close()
' Else
'MsgBox("Incorrect username or
password!", MsgBoxStyle.Critical,
"Login")
'txtPass.Focus()
'End If
'Catch ex As Exception
' MsgBox(ex.Message)
' Finally
'cmd.Dispose()
'con.Close()
'End Try
Dim check As New
OleDb.OleDbDataAdapter("Select *
from tblStudentInfo WHERE
A_Usertype = '" & cbotype.Text & "'
AND A_Username = '" & txtUser.Text &
"' AND A_Pass = '" & txtPass.Text & "'",
con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count = 1 Then
If cbotype.Text = "Reviewee"
Then
MainForm.lblReviewerID.Text
= ""
MainForm.lblReviewerID.Text
= d1.Rows(0).Item("A_ReviewerID")
MainForm.lblCourse.Text =
d1.Rows(0).Item("A_Course")
MainForm.lblSpec.Text =
d1.Rows(0).Item("A_Specialization")
End If
MainForm.txtid.Text =
txtUser.Text
txtUser.Text = ""
txtPass.Text = ""
Me.Close()
Else

MsgBox("Incorrect username
or password!", MsgBoxStyle.Critical,
"Login")
txtPass.Focus()
End If
con.Close()
End Sub
Private Sub btnSignIn_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnSignIn.Click
Login()
Dim check4 As New
OleDb.OleDbDataAdapter("Select *
from tblSetAssessmentNo", con)
Dim d2 As New DataTable
check4.Fill(d2)
If d2.Rows.Count = 1 Then
MainForm.lblAssNum.Text =
d2.Rows(0).Item("AssessmentNo")
End If
If cbotype.Text = "Reviewee"
Then
MainForm.mnuStudentInfo.Enabled =
False
MainForm.mnuAddQuestion.Enabled =
False
MainForm.mnuAddMajor.Enabled =
False
MainForm.AddAccountToolStripMenuIte
m.Enabled = False
MainForm.GenerateExamToolStripMen
uItem.Enabled = False
MainForm.setassessment.Enabled =
False
MainForm.AssessmentLogToolStripMen
uItem.Enabled = True
MainForm.SummaryResultToolStripMen
uItem.Enabled = False

MainForm.IndividualResultToolStripMen
uItem.Enabled = True

MainForm.IndividualResultToolStripMen
uItem.Enabled = False

MainForm.mnuTimeDurationSettings.E
nabled = False

MainForm.mnuTimeDurationSettings.E
nabled = True

ElseIf cbotype.Text = "Facilitator"

MainForm.TimePerExaminationToolStri
pMenuItem.Enabled = False

Then
MainForm.mnuStudentInfo.Enabled =
False
MainForm.mnuAddQuestion.Enabled =
False
MainForm.mnuAddMajor.Enabled =
False
MainForm.AddAccountToolStripMenuIte
m.Enabled = False
MainForm.AssessmentLogToolStripMen
uItem.Enabled = False

MainForm.TimePerQuestionToolStripMe
nuItem.Enabled = False
ElseIf cbotype.Text = "Admin"
Then
MainForm.TimePerExaminationToolStri
pMenuItem.Enabled = False
MainForm.TimePerQuestionToolStripMe
nuItem.Enabled = False
End If
End Sub
End Class

MainForm.SummaryResultToolStripMen
uItem.Enabled = True

Imports System.Data.OleDb
Public Class MainForm

Private Sub
ToolStripMenuItem3_Click(ByVal

sender As System.Object, ByVal e As


System.EventArgs) Handles
mnuStudentInfo.Click
StudentInformation.ShowDialog()
End Sub
Private Sub
ToolStripMenuItem2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
mnuAddQuestion.Click
AddNewQuestions.ShowDialog()
End Sub
Private Sub
ToolStripMenuItem1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
mnuAddMajor.Click
Major.ShowDialog()
End Sub
Private Sub
GenerateExamToolStripMenuItem_Clic
k(ByVal sender As System.Object,
ByVal e As System.EventArgs)
GenerateExam.ShowDialog()
End Sub
Private Sub
AssessmentLogToolStripMenuItem_Clic
k(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
AssessmentLogToolStripMenuItem.Clic
k
Assessment_Log.ShowDialog()
End Sub
Private Sub
IndividualResultToolStripMenuItem_Clic
k(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
IndividualResultToolStripMenuItem.Clic
k
IndividualResult.ShowDialog()
End Sub
Private Sub
SummaryResultToolStripMenuItem_Clic
k(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
SummaryResultToolStripMenuItem.Clic
k
SummaryResult.ShowDialog()
End Sub

Private Sub MainForm_Load(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
MyBase.Load
LoginForm.ShowDialog()
End Sub
Private Sub
AddAccountToolStripMenuItem_Click(B
yVal sender As System.Object, ByVal e
As System.EventArgs) Handles
AddAccountToolStripMenuItem.Click
AddAccount.ShowDialog()
End Sub
Private Sub
ChangeAccountToolStripMenuItem_Clic
k(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
ChangeAccountToolStripMenuItem.Clic
k
Change_Account.ShowDialog()
End Sub
Private Sub
LogOutToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
LogOutToolStripMenuItem.Click
If MsgBox("Are you sure you want
to log out the system?",
MsgBoxStyle.YesNo, "System Exit") =
MsgBoxResult.Yes Then
LoginForm.ShowDialog()
End If
End Sub
Private Sub
TimePerExaminationToolStripMenuItem
_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
TimePerExaminationToolStripMenuItem
.Click
frmStart1.Show()
End Sub
Private Sub
GenerateExamToolStripMenuItem_Clic
k_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
GenerateExamToolStripMenuItem.Click
GenerateExam.ShowDialog()
End Sub
Private Sub
TimePerQuestionToolStripMenuItem_Cli

ck(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles
TimePerQuestionToolStripMenuItem.Cli
ck
frmstart2.ShowDialog()
'Form1.ShowDialog()
End Sub
Private Sub
TimePerExaminationToolStripMenuItem
1_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
TimePerExaminationToolStripMenuItem
1.Click
TimeDuration.ShowDialog()
End Sub

Private Sub
TimePerQuestionToolStripMenuItem1_
Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
TimePerQuestionToolStripMenuItem1.C
lick
TimePerQuestion.ShowDialog()
End Sub
Private Sub
ToolStripMenuItem1_Click_1(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
setassessment.Click
SetAssessmentNo.ShowDialog()
End Sub
End Class

Imports System.Data.OleDb
Public Class StudentInformation
Public Strcon As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=" &
Application.StartupPath &
"\Assessment.mdb"
Dim con As OleDb.OleDbConnection
= New OleDb.OleDbConnection(Strcon)
Dim da As New
OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim sql As String

Private Sub Button3_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
btnClose.Click
Me.Close()
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnSignIn.Click
Me.Close()
LoginForm.cbotype.Focus()
End Sub

Private Sub btnAdd_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
btnAdd.Click
If txtPass.Text =
txtPassCon.Text Then
addinfo()
clear()
btnAdd.Enabled = False
btnSignIn.Enabled = True
Else
MsgBox("Password didn't
match!")
txtPass.Text = ""
txtPassCon.Text = ""
txtPass.Focus()
End If
End Sub
Public Sub clear()
Me.txtID.Text = ""
Me.txtName.Text = ""
Me.txtPass.Text = ""
Me.txtPassCon.Text = ""
Me.txtUserName.Text = ""
Me.cboSpec.Text = ""
Me.cboCourse.Text = ""
Me.txttype.Text = ""
Panel3.Visible = False
End Sub
Private Sub addinfo()
Try
con.Open()
sql = "INSERT INTO
tblStudentInfo (A_ReviewerID,
A_Name, A_Course, A_Specialization,
A_Usertype, A_Username,
A_Pass)VALUES('" & Me.txtID.Text &
"','" & _
Me.txtName.Text & "','"
& Me.cboCourse.Text & "','" &
Me.cboSpec.Text & "','" &
Me.txttype.Text & "','" &
Me.txtUserName.Text & "','" &
Me.txtPass.Text & "')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("You are
successfully registered, Go to Sign
In", MsgBoxStyle.Information,
"Regitration Information")
Else

MsgBox("Failed to
add registere",
MsgBoxStyle.Critical, "Registration
Information")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button1.Click
If cboCourse.Text = "BSED"
Then
If cboSpec.Text = ""
Then
MsgBox("Please fill
all the fields!",
MsgBoxStyle.Critical,
"Requirements")
Else
Panel3.Visible =
True
txttype.Text =
"Reviewee"
btnAdd.Enabled =
True
End If
ElseIf txtID.Text = "" Then
MsgBox("Please fill all
the fields!", MsgBoxStyle.Critical,
"Requirements")
ElseIf txtName.Text = ""
Then
MsgBox("Please fill all
the fields!", MsgBoxStyle.Critical,
"Requirements")
ElseIf cboCourse.Text = ""
Then
MsgBox("Please fill all
the fields!", MsgBoxStyle.Critical,
"Requirements")
Else
Panel3.Visible = True
txttype.Text =
"Reviewee"
btnAdd.Enabled = True
End If
End Sub
Private Sub
StudentInformation_Load(ByVal sender
As System.Object, ByVal e As

System.EventArgs) Handles
MyBase.Load
AutoNo()
sql = "Select * from
tblMajor"
cboSpecy(sql, cboSpec)
End Sub
Public Sub cboSpecy(ByVal sql As
String, ByVal cbo As ComboBox)
Try
con.Open()
da = New
OleDb.OleDbDataAdapter(sql, con)
ds = New DataSet
da.Fill(ds, "userdb")
With cbo
.DataSource =

ds.Tables(0)

.DisplayMember =

"Specialization"
"SpecID"

.ValueMember =
End With

Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
End Sub
Sub AutoNo()
Try
con.Open()
sql = "SELECT
A_ReviewerID FROM tblStudentInfo
Order By A_ReviewerID desc"

ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
If dr.Read = True Then
txtID.Text =
Val(dr(0)) + 1
Else
txtID.Text = 10001
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub
cboCourse_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
cboCourse.SelectedIndexChanged
If Me.cboCourse.Text =
"BEED" Then
Label4.Visible = False
cboSpec.Text = ""
cboSpec.Visible = False
Else
Label4.Visible = True
cboSpec.Visible = True
End If
End Sub
End Class

Imports System.Data.OleDb
Public Class AddNewQuestions
Private Sub delrecord()
Try
sql = "DELETE * FROM
tblAddQuestion WHERE A_QuestionID =
'" & txtQuesID.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Question
Deleted", MsgBoxStyle.Information,
"Question Information")
Else
MsgBox("Failed to
Delete Question",
MsgBoxStyle.Critical, "Question
Information")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub addQuestion()
Try
sql = "INSERT INTO
tblAddQuestion (id, A_Question,
A_Category, A_Specialization,
A_AnsA, A_AnsB, A_AnsC, A_AnsD,
A_CorrectAns)VALUES('" &
txtCount.Text & _
"', '" &
Me.txtQuestion.Text & "', '" &
cboCategory.Text & "', '" &
cboSpec.Text & "', '" & txtA.Text &
"', '" & txtB.Text & "', '" &
txtC.Text & "', '" & txtD.Text & "',
'" & cboCorrectAns.Text & "')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then

MsgBox("Question
Added", MsgBoxStyle.Information,
"Question Information")
Else
MsgBox("Failed to
add Question", MsgBoxStyle.Critical,
"Question Information")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub loadquestion()
Try
sql = "SELECT
A_QuestionID, A_Question,
A_Category, A_Specialization,
A_AnsA, A_AnsB, A_AnsC, A_AnsD,
A_CorrectAns FROM tblAddQuestion"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
dgvQuestions.Rows.Clear()
Do While dr.Read = True
dgvQuestions.Rows.Add(dr(0), dr(1),
dr(2), dr(3), dr(4), dr(5), dr(6),
dr(7), dr(8))
Loop
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub SearchQuestion()
Try
sql = "SELECT
A_QuestionID, A_Question,
A_Category, A_Specialization,
A_AnsA, A_AnsB, A_AnsC, A_AnsD,

A_CorrectAns FROM tblAddQuestion


WHERE A_Question LIKE '" & _
txtsearch.Text & "%'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
dgvQuestions.Rows.Clear()
Do While dr.Read = True
dgvQuestions.Rows.Add(dr(0), dr(1),
dr(2), dr(3), dr(4), dr(5), dr(6),
dr(7), dr(8))
Loop
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnclose.Click
Me.Close()
End Sub
Public Sub clear()
Me.txtQuesID.Text = ""
Me.txtQuestion.Text = ""
Me.cboCategory.Text = ""
Me.cboSpec.Text = ""
Me.txtsearch.Text = ""
Me.txtA.Text = ""
Me.txtB.Text = ""
Me.txtC.Text = ""
Me.txtD.Text = ""
Me.cboCorrectAns.Text = ""
End Sub
Sub AutoNo()
Try
sql = "SELECT
A_QuestionID FROM tblAddQuestion
Order By A_QuestionID desc"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
If dr.Read = True Then

txtQuesID.Text =

Val(dr(0)) + 1
Else

txtQuesID.Text = 1
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Sub AutoNo2()
If cboCategory.Text <>
"Major" Then
Try
sql = "SELECT id,
A_Category FROM tblAddQuestion
where A_Category ='" &
Me.cboCategory.Text & "' Order By id
desc"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
If dr.Read = True
Then
Me.txtCount.Text
= Val(dr(0)) + 1
Else
txtCount.Text =
1
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
Else
Try
sql = "SELECT id,
A_QuestionID , A_Category,
A_Specialization FROM
tblAddQuestion where A_Category ='"
& Me.cboCategory.Text & "' and
A_Specialization='" & cboSpec.Text &
"' Order By A_QuestionID desc"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)

If dr.Read = True

Then

Me.txtCount.Text

= Val(dr(0)) + 1
Else

txtCount.Text =

End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
End Sub
Private Sub
cboCategory_SelectedIndexChanged(ByV
al sender As System.Object, ByVal e
As System.EventArgs)
If cboCategory.Text =
"Major" Then
lblSpec.Visible = True
cboSpec.Visible = True
Else
lblSpec.Visible = False
cboSpec.Visible = False
End If
End Sub
Private Sub
AddNewQuestions_Load(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
MyBase.Load
btnSave.Enabled = False
btnupdate.Enabled = False
btncancel.Enabled = False
disabledtext()
loadquestion()
dgvQuestions.Enabled = False
btncancel.Enabled = False
End Sub
Private Sub
btnsearch_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs)
SearchQuestion()
End Sub
Private Sub btnAdd_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnAdd.Click
If cboCategory.Text = ""
Then
MsgBox("select category
first")
Else

False

btnsearch.Enabled =

btnAdd.Enabled = False
btnSave.Enabled = True
btncancel.Enabled = True
enabledtext()
AutoNo()
AutoNo2()
txtQuestion.Focus()
End If
End Sub
Private Sub
dgvQuestions_CellContentDoubleClick(
ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCel
lEventArgs) Handles
dgvQuestions.CellContentDoubleClick
btnupdate.Enabled = True
End Sub
Private Sub
dgvQuestions_CellDoubleClick(ByVal
sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCel
lEventArgs) Handles
dgvQuestions.CellDoubleClick
txtQuesID.Text =
dgvQuestions.CurrentRow.Cells(0).Val
ue
txtQuestion.Text =
dgvQuestions.CurrentRow.Cells(1).Val
ue
cboCategory.Text =
dgvQuestions.CurrentRow.Cells(2).Val
ue
cboSpec.Text =
dgvQuestions.CurrentRow.Cells(3).Val
ue
txtA.Text =
dgvQuestions.CurrentRow.Cells(4).Val
ue
txtB.Text =
dgvQuestions.CurrentRow.Cells(5).Val
ue
txtC.Text =
dgvQuestions.CurrentRow.Cells(6).Val
ue
txtD.Text =
dgvQuestions.CurrentRow.Cells(7).Val
ue
cboCorrectAns.Text =
dgvQuestions.CurrentRow.Cells(8).Val
ue
btnAdd.Enabled = False
btnupdate.Enabled = True
End Sub
Private Sub updatequestion()
Try

sql = "UPDATE
tblAddQuestion SET A_Question = '" &
_
txtQuestion.Text &
"', A_Category = '" & _
cboCategory.Text & "',
A_Specialization = '" & _
cboSpec.Text &
"', A_AnsA = '" & _
txtA.Text & "',
A_AnsB = '" & _
txtB.Text & "',
A_AnsC = '" & _
txtC.Text & "',
A_AnsD = '" & _
txtD.Text & "',
A_CorrectAns = '" & _
cboCorrectAns.Text & "'
WHERE A_QuestionID = " &
Val(txtQuesID.Text) & ""
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Question
Updated", MsgBoxStyle.Information,
"Update quetion")
loadquestion()
Else
MsgBox("Failed to
Update question",
MsgBoxStyle.Information, "Update
question")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub btnEdit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnupdate.Click
updatequestion()
clear()
disabledtext()
btnupdate.Enabled = False
btnAdd.Enabled = True
dgvQuestions.Enabled = False
btnsearch.Enabled = True
End Sub
Private Sub
Button2_Click_1(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles
btncancel.Click
btnAdd.Enabled = True
btnSave.Enabled = False
btnsearch.Enabled = True
btnupdate.Enabled = False
clear()
disabledtext()
btncancel.Enabled = False
End Sub
Private Sub disabledtext()
txtsearch.Enabled = False
txtQuesID.Enabled = False
txtQuestion.Enabled = False
txtA.Enabled = False
txtB.Enabled = False
txtC.Enabled = False
txtD.Enabled = False
'cboCategory.Enabled = False
cboCorrectAns.Enabled =
False
'cboSpec.Enabled = False
End Sub
Private Sub enabledtext()
txtsearch.Enabled = True
txtQuestion.Enabled = True
txtA.Enabled = True
txtB.Enabled = True
txtC.Enabled = True
txtD.Enabled = True
cboCategory.Enabled = True
cboCorrectAns.Enabled = True
cboSpec.Enabled = True
End Sub
Private Sub
txtsearch_TextChanged(ByVal sender
As System.Object, ByVal e As
System.EventArgs) Handles
txtsearch.TextChanged
SearchQuestion()
enabledtext()
btnsearch.Enabled = False
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnSave.Click
addQuestion()
loadquestion()
clear()
disabledtext()
btnSave.Enabled = False
btnAdd.Enabled = True
btnsearch.Enabled = True
End Sub
Private Sub disabledbutton()

btnSave.Enabled = False
btnupdate.Enabled = False
btnsearch.Enabled = False
btnclose.Enabled = False
End Sub
Private Sub
btnsearch_Click_1(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
btnsearch.Click
txtsearch.Enabled = True
txtsearch.Focus()
dgvQuestions.Enabled = True
btnAdd.Enabled = False
btncancel.Enabled = True
End Sub

Imports System.Data.OleDb
Public Class SetAssessmentNo
Public Strcon As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=" &
Application.StartupPath &
"\Assessment.mdb"
Dim con As OleDb.OleDbConnection
= New OleDb.OleDbConnection(Strcon)
Dim da As New
OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim sql As String
Private Sub
Button1_Click_1(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Button1.Click

Private Sub
cboCategory_TextChanged(ByVal
As Object, ByVal e As
System.EventArgs) Handles
cboCategory.TextChanged
If cboCategory.Text =
"Major" Then
lblSpec.Visible =
cboSpec.Visible =
Else
lblSpec.Visible =
cboSpec.Visible =
End If
End Sub
End Class

Then

Then

sender

True
True
False
False

' If Button1.Text = "Set"


' Button1.Text = "Ok"
'AutoNo()
'ElseIf Button1.Text = "Ok"

'Button1.Text = "Set"
updateAssessmentNo()
txtassessno.Text = ""
'End If
End Sub
Sub AutoNo()
Try
con.Open()
sql = "SELECT
AssessmentNo FROM tblSetAssessmentNo
Order By AssessmentNo desc"
ConnectDB()

cmd = New
OleDbCommand(sql, con)
dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
If dr.Read = True Then
txtassessno.Text =
Val(dr(0)) + 1
Else
txtassessno.Text =
101
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub updateAssessmentNo()
Try
con.Open()
sql = "UPDATE
tblSetAssessmentNo SET AssessmentNo
= '" & _
txtassessno.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)

Imports System.Data.OleDb
Public Class Major
Private Sub btnAdd_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnAdd.Click
If txtSpecialization.Text =
"" Then
MsgBox("need to insert
specialization!")
Else

Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Assessment
Number Set",
MsgBoxStyle.Information, "Assessment
No. Set")
Else
MsgBox("Failed to
set Assessment Number",
MsgBoxStyle.Information, "Assessment
No. Set")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button2.Click
Me.Close()
End Sub
End Class

addQuestion()
loadmajor()
txtSpecialization.Text =
""

End If
End Sub
Private Sub addQuestion()
Try
sql = "INSERT INTO
tblMajor (Specialization) VALUES ('"
& Me.txtSpecialization.Text & "')"

ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Major
Added", MsgBoxStyle.Information,
"Major Information")
Else
MsgBox("Failed to
add Major", MsgBoxStyle.Critical,
"Major Information")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Private Sub loadmajor()
Try
sql = "SELECT
Specialization FROM tblMajor"
ConnectDB()
cmd = New
OleDbCommand(sql, con)

dr =
cmd.ExecuteReader(CommandBehavior.Cl
oseConnection)
dgvmajor.Rows.Clear()
Do While dr.Read = True

Imports System.Data.OleDb
Public Class TimeDuration
Public Strcon As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=" &
Application.StartupPath &
"\Assessment.mdb"
Dim con As OleDb.OleDbConnection
= New OleDb.OleDbConnection(Strcon)
Dim da As New
OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim sql As String

Private Sub Button2_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button1.Click
updatetime()
txthour.Text = ""
txtmin.Text = ""

dgvmajor.Rows.Add(dr(0))
Loop
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
Public Sub clear()
Me.txtSpecialization.Text =
""
End Sub
Private Sub Major_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
MyBase.Load
loadmajor()
End Sub
End Class

End Sub
Private Sub settime()
Try
con.Open()
sql = "INSERT INTO
tbltime (A_Hours, A_Min)VALUES('" &
Me.txthour.Text & "','" & _
Me.txtmin.Text & "')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("You are
successfully set the time, Go to
Sign In", MsgBoxStyle.Information,
"Set Time")
Else
MsgBox("Failed to
set the time", MsgBoxStyle.Critical,
"Set Time")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try

End Sub
Private Sub updatetime()
Try
con.Open()
sql = "UPDATE tbltime
SET A_Hours = '" & _
txthour.Text & "',
A_Min = '" & _
txtmin.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i = cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Time set",
MsgBoxStyle.Information, "Time Set")
Else
MsgBox("Failed to
set the time",
MsgBoxStyle.Information, "Time Set")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
End Class

Imports System.Data.OleDb
Public Class Change_Account
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button2.Click
Me.Close()
End Sub
Private Sub
btnchange_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
btnchange.Click

If txtconpass.Text =
txtnewpass.Text Then
Try
sql = "UPDATE
tblStudentInfo SET A_Pass = '" & _
txtnewpass.Text &
"' WHERE A_Username = '" &
MainForm.txtid.Text & "' AND A_Pass
= '" & txtoldpass.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer

i =
cmd.ExecuteNonQuery
If i > 0 Then
MsgBox("Password
successfully changed :-)",
MsgBoxStyle.Information, "Change
Password")
txtconpass.Text
= ""
txtnewpass.Text
= ""
txtoldpass.Text
= ""
Else
MsgBox("Sorry
you have entered incorrect
password :-(",
MsgBoxStyle.Exclamation, "Change
Password")
txtoldpass.Text
= ""

txtoldpass.Focus()
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
Else
MsgBox("Password didn't
match :-P", MsgBoxStyle.Information,
"Update password")
txtconpass.Text = ""
txtnewpass.Text = ""
txtnewpass.Focus()
End If
End Sub
End Class

Imports System.Data.OleDb
Public Class frmStart1
Dim num2, ctr, cnt, Qnum As
Integer
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button1.Click
If Me.cboCategory.Text =
"Prof. Ed." Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID ='" &
MainForm.lblReviewerID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category = '" & cboCategory.Text &
"' and Specialization = '-'", con)
Dim dt11 As New
DataTable

Then

check11.Fill(dt11)
If dt11.Rows.Count <> 0

MsgBox("You have
already taken this assessment!!")
Exit Sub
'Else
End If
Examination1.txtCategory.Text =
"Prof. Ed."
Examination1.txtspec.Text = "-"
ElseIf cboCategory.Text =
"Gen. Ed." Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
Category = '" & cboCategory.Text &
"' and Specialization = '-' and

ReviewerID ='" &


MainForm.lblReviewerID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "'", con)
Dim dt11 As New
DataTable
check11.Fill(dt11)
If dt11.Rows.Count <> 0
Then
MsgBox("You have
already taken this assessment!!")
Exit Sub
End If
Examination1.txtCategory.Text =
"Gen. Ed."
Examination1.txtspec.Text = "-"
Else
If cboCategory.Text =
"Major" And cboSpec.Text <> "" Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
Category = '" & cboCategory.Text &
"' and Specialization = '" &
cboSpec.Text & "' and ReviewerID ='"
& MainForm.lblReviewerID.Text & "'
and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "'", con)
Dim dt11 As New
DataTable
check11.Fill(dt11)
If dt11.Rows.Count
<> 0 Then
MsgBox("You have
already taken this assessment!!")
Exit Sub
End If
Examination1.txtCategory.Text =
"Major"
Examination1.txtspec.Text =
Me.cboSpec.Text
ElseIf cboCategory.Text
= "Major" And cboSpec.Text = "" Then
MsgBox("Select a
major first!")
Exit Sub
End If
End If
Examination1.txtCategory.Text =
Me.cboCategory.Text

Examination1.txtspec.Text =
Me.cboSpec.Text
Examination1.txtAssessmentNum.Text =
MainForm.lblAssNum.Text
Me.Close()
Examination1.txtRevID.Text =
MainForm.lblReviewerID.Text
Examination1.Timer1.Enabled
= True
' get the time
Dim min, sec As Integer
Dim check4 As New
OleDb.OleDbDataAdapter("Select *
from tblTime2", con)
Dim d2 As New DataTable
check4.Fill(d2)
If d2.Rows.Count = 1 Then
min =
d2.Rows(0).Item("a_Min")
sec =
d2.Rows(0).Item("a_sec")
If min <> 0 And sec = 0
Then
min = min - 1
sec = 59
End If
End If
Examination1.lblmin.Text =
min
Examination1.lblsec.Text =
sec
Examination1.txtmin.Text =
min
Examination1.txtsec.Text =
sec
Examination1.txtQid.Text =
"1"
Examination1.ShowDialog()
End Sub
Private Sub
cboCategory_TextChanged(ByVal sender
As Object, ByVal e As
System.EventArgs) Handles
cboCategory.TextChanged
If MainForm.lblCourse.Text =
"BEED" Then
MsgBox("You are not
allowed to answer Major Questions
because you don't have a major")
cboCategory.Text = ""
cboSpec.Text = ""
cboCategory.Focus()
End If
If cboCategory.Text =
"Major" Then

lblSpec.Visible = True
cboSpec.Visible = True
Else

lblSpec.Visible = False
cboSpec.Visible = False
End If
End Sub
Private Sub
cboSpec_TextChanged(ByVal sender As

Imports System.Data.OleDb
Public Class frmstart2
Dim num2, ctr, cnt, Qnum As
Integer
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button1.Click
If Me.cboCategory.Text =
"Prof. Ed." Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID ='" &
MainForm.lblReviewerID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and

Object, ByVal e As System.EventArgs)


Handles cboSpec.TextChanged
If MainForm.lblSpec.Text <>
cboSpec.Text Then
MsgBox("You are only
allowed to answer questions that are
not your Major")
End If
End Sub
End Class

Category = '" & cboCategory.Text &


"' and Specialization = '-'", con)
Dim dt11 As New
DataTable
check11.Fill(dt11)
If dt11.Rows.Count <> 0
Then
MsgBox("You have
already taken this assessment!!")
Exit Sub
'Else
End If
Examination2.txtCategory.Text =
"Prof. Ed."
Examination2.txtspec.Text = "-"

ElseIf cboCategory.Text =
"Gen. Ed." Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
Category = '" & cboCategory.Text &
"' and Specialization = '-' and
ReviewerID ='" &
MainForm.lblReviewerID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "'", con)
Dim dt11 As New
DataTable
check11.Fill(dt11)
If dt11.Rows.Count <> 0
Then
MsgBox("You have
already taken this assessment!!")
Exit Sub
End If
Examination2.txtCategory.Text =
"Gen. Ed."
Examination2.txtspec.Text = "-"
Else
If cboCategory.Text =
"Major" And cboSpec.Text <> "" Then
Dim check11 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
Category = '" & cboCategory.Text &
"' and Specialization = '" &
cboSpec.Text & "' and ReviewerID ='"
& MainForm.lblReviewerID.Text & "'
and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "'", con)
Dim dt11 As New
DataTable
check11.Fill(dt11)
If dt11.Rows.Count
<> 0 Then
MsgBox("You have
already taken this assessment!!")
Exit Sub
End If
Examination2.txtCategory.Text =
"Major"
Examination2.txtspec.Text =
Me.cboSpec.Text
ElseIf cboCategory.Text
= "Major" And cboSpec.Text = "" Then
MsgBox("Select a
major first!")

Exit Sub
End If
End If
Examination2.txtCategory.Text =
Me.cboCategory.Text
Examination2.txtspec.Text =
Me.cboSpec.Text
Examination2.txtAssessmentNum.Text =
MainForm.lblAssNum.Text
Me.Close()
Examination2.txtRevID.Text =
MainForm.lblReviewerID.Text
Examination2.Timer1.Enabled
= True
' get the time
Dim min, hr, sec As Integer
Dim check4 As New
OleDb.OleDbDataAdapter("Select *
from tblTime", con)
Dim d2 As New DataTable
check4.Fill(d2)
If d2.Rows.Count = 1 Then
min =
d2.Rows(0).Item("A_Min")
hr =
d2.Rows(0).Item("A_Hours")
If min <> 0 And hr = 0
Then
min = min - 1
sec = 59
ElseIf min <> 0 And hr
<> 0 Then
hr = hr
min = min - 1
sec = 59
ElseIf hr <> 0 And min =
0 Then
hr = hr - 1
min = 59
sec = 59
End If
End If
Examination2.lblHr.Text = hr
Examination2.lblMin.Text =
min
Examination2.lblSec.Text =
sec
Examination2.txtQid.Text =
"1"
Examination2.ShowDialog()
End Sub
Private Sub
cboCategory_TextChanged(ByVal sender

As Object, ByVal e As
System.EventArgs) Handles
cboCategory.TextChanged
If MainForm.lblCourse.Text =
"BEED" Then
MsgBox("You are not
allowed to answer Major Questions
because you don't have a major")
cboCategory.Text = ""
cboSpec.Text = ""
cboCategory.Focus()
End If
If cboCategory.Text =
"Major" Then
lblSpec.Visible = True
cboSpec.Visible = True
Else

lblSpec.Visible = False
cboSpec.Visible = False
End If
End Sub
Private Sub
cboSpec_TextChanged(ByVal sender As
Object, ByVal e As System.EventArgs)
Handles cboSpec.TextChanged
If MainForm.lblSpec.Text <>
cboSpec.Text Then
MsgBox("You are only
allowed to answer questions that are
not your Major")
End If
End Sub
End Class

System.EventArgs) Handles
Timer1.Tick
lblSec.Text =
Val(lblSec.Text) - 1
If lblMin.Text = 0 And
lblHr.Text = 0 And lblSec.Text = 0
Then
Timer1.Enabled = False
End If
End Sub

Imports System.Data.OleDb
Public Class Examination2
Private Sub Button9_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button9.Click
Me.Close()
End Sub
Private Sub Timer1_Tick(ByVal
sender As System.Object, ByVal e As

Private Sub
txtRevID_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
txtRevID.TextChanged
Dim check As New
OleDb.OleDbDataAdapter("Select *
from tblStudentInfo where
A_ReviewerID ='" & Me.txtRevID.Text
& "'", con)
Dim d1 As New DataTable
check.Fill(d1)

End If
End If
End Sub
Private Sub btna_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btna.Click
ConnectDB()
If d1.Rows.Count = 1 Then
Me.txtname.Text =
d1.Rows(0).Item("A_Name")
Me.txtCourse.Text =
d1.Rows(0).Item("A_Course")
Me.txtspec.Text =
d1.Rows(0).Item("A_Specialization")
End If
End Sub
Private Sub
Examination2_Load(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
MyBase.Load
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("select *
from tblGeneratedQuestion where
AssessmentNum='" &
MainForm.lblAssNum.Text & "' and
Category='" & txtCategory.Text &
"'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count <> 0
Then
txtNumQuestion.Text
= dt2.Rows.Count
End If
Else
Dim check2 As New
OleDb.OleDbDataAdapter("select *
from tblGeneratedQuestion where
AssessmentNum='" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count <> 0
Then
txtNumQuestion.Text
= dt2.Rows.Count

If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btna.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
txtPoint.Text = "1"
ElseIf btna.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btna.Text
'update answer
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"

cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
cmd.Dispose()

Finally

Else

con.Close()
End Try
End If
End If

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try

sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub btnb_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles btnb.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnb.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnb.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btnb.Text
'update answer
If txtCategory.Text <>
"Major" Then

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _

Me.txtAns.Text & "', Points = " & _


txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If

Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "

& Val(QuestID.Text) & ",'" &


MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub btnc_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles btnc.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnc.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnc.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btnc.Text
'update answer
'update answer
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &

MainForm.lblAssNum.Text & "','" &


Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
cmd.Dispose()

Finally
con.Close()
End Try

End If
End If
Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer

Try

sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
End If
End If
End Sub
Private Sub btnd_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnd.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnd.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnd.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btnd.Text
'update answer

If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try

sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
End If
Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,

Specialization) VALUES (" &


Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception

MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub Button5_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
Button5.Click
Dim limit As Integer
limit =
Val(txtNumQuestion.Text)
If limit = Val(txtQid.Text)
Then
Button5.Enabled = False
ElseIf Val(txtQid.Text) <
limit Then
'GET ANOTHER QUESTION
txtQid.Text =
Val(txtQid.Text) + 1
End If
txtAns.Text = ""
End Sub
Private Sub Button6_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button6.Click
If txtQid.Text = 1 Then
Button5.Enabled = True
Button6.Enabled = False
Exit Sub
ElseIf txtQid.Text <> 1 Then
Button6.Enabled = True
Button5.Enabled = True
txtQid.Text =
Val(txtQid.Text) - 1
End If
End Sub
Private Sub
txtQid_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
txtQid.TextChanged
' On Error Resume Next

If txtCategory.Text = "Prof.
Ed." Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& Val(txtQid.Text) & " and
AssessmentNum = '" &
txtAssessmentNum.Text & "' and
A_Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
QuestID.Text =
d1.Rows(0).Item("A_QuestionID")
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")
Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
End If
ElseIf txtCategory.Text =
"Gen. Ed." Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& Val(txtQid.Text) & " and
AssessmentNum = '" &
txtAssessmentNum.Text & "' and
A_Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
QuestID.Text =
d1.Rows(0).Item("A_QuestionID")
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")
Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")

'Me.txtAns.Text =
d1.Rows(0).Item("Stud_Answer")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
'Me.txtPoint.Text =
d1.Rows(0).Item("Points")
End If
ElseIf txtCategory.Text =
"Major" Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& txtQid.Text & " and AssessmentNum
= '" & txtAssessmentNum.Text & "'
and A_Category ='" &
txtCategory.Text & "' and
A_Specialization ='" & txtspec.Text
& "'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")
Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")
'Me.txtAns.Text =
d1.Rows(0).Item("Stud_Answer")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
'Me.txtPoint.Text =
d1.Rows(0).Item("Points")
End If
End If
End Sub
Private Sub
lblSec_TextChanged(ByVal sender As
Object, ByVal e As System.EventArgs)
Handles lblSec.TextChanged
'lblSec.Text =
Format(lblSec.Text, "00")
If Val(lblMin.Text) <> 0 And
Val(lblHr.Text) <> 0 Then
If Val(lblSec.Text) = 0
Then
lblMin.Text =
Val(lblMin.Text) - 1
lblSec.Text = 59

End If
ElseIf Val(lblMin.Text) = 0
And Val(lblHr.Text) <> 0 Then
If Val(lblSec.Text) = 0
Then
lblHr.Text =
Val(lblHr.Text) - 1
lblMin.Text = 59
lblSec.Text = 59
End If
ElseIf Val(lblMin.Text) <> 0
And Val(lblHr.Text) = 0 Then
If Val(lblSec.Text) = 0
Then
lblMin.Text =
Val(lblMin.Text) - 1
lblSec.Text = 59
End If
ElseIf lblMin.Text = "0" And
lblHr.Text = "0" And lblSec.Text =
"0" Then
Timer1.Enabled = False
If txtCategory.Text <>
"Major" Then
totScoreEd()
Else
totScoreMajor()
End If
Me.Close()
frmResult.ShowDialog()
End If
End Sub
Private Sub lblSec_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
lblSec.Click
End Sub
Private Sub Button7_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button7.Click
If txtCategory.Text <>
"Major" Then
totScoreEd()
Else
totScoreMajor()
End If
End Sub
Private Sub totScoreEd()
Dim score As Integer
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryTotalScore where ReviewerID
='" & Me.txtRevID.Text & "' and

AssessmentNumber ='" &


MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count = 1 Then
score =
d1.Rows(0).Item("SumOfPoints")
lblSec.Text = "0"
resultText = "Your score
is " & score & " out of " &
txtNumQuestion.Text & ""
examPercent = (score /
Val(txtNumQuestion.Text)) * 100
If examPercent <= 50
Then
studentLevel =
"Beginner"
ElseIf examPercent > 50
And examPercent <= 70 Then
studentLevel =
"Intermediate"
ElseIf examPercent > 70
And examPercent <= 100 Then
studentLevel =
"Advanced"
End If
Dim check5 As New
OleDb.OleDbDataAdapter("Select *
from tblExamInfo where ReviewerID =
'" & MainForm.lblReviewerID.Text &
"' and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d5 As New DataTable
check5.Fill(d5)
If Val(d5.Rows.Count) =
0 Then
Try
sql = "INSERT
INTO tblExamInfo (ReviewerID,
AssessmentNumber, ExamDate,
StudScore, ScorePercentage,
StudLevel, Category, Specialization)
VALUES ('" &
MainForm.lblReviewerID.Text & "','"
& MainForm.lblAssNum.Text & "','" &
Format(Now, "dd-MMM-yy") & "','" &
score & "','" & examPercent & "','"
& studentLevel & "','" &
txtCategory.Text & "','-')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)

Dim i As Integer
i =
cmd.ExecuteNonQuery

If i > 0 Then

'MsgBox("Question Added",
MsgBoxStyle.Information, "Question
Information")
Else
MsgBox("Failed to add Question",
MsgBoxStyle.Critical, "Question
Information")
End If
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
Me.Button5.Enabled =
True

Me.Close()
resultText = "You got "
& score & " out of " &
Me.txtNumQuestion.Text
With frmResult
.TextBox1.Text =
txtRevID.Text
.ShowDialog()
End With
'MsgBox("TIME'S UP!!!!
Your score is " & score & " out of "
& txtNumQuestion.Text & "")
End If
End Sub
Private Sub totScoreMajor()
Dim score As Integer
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryTotalScore where ReviewerID
='" & Me.txtRevID.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count = 1 Then
score =
d1.Rows(0).Item("SumOfPoints")

lblSec.Text = "0"
resultText = "Your score
is " & score & " out of " &
txtNumQuestion.Text & ""
examPercent = (score /
Val(txtNumQuestion.Text)) * 100
If examPercent <= 50
Then
studentLevel =
"Beginner"
ElseIf examPercent > 50
And examPercent <= 70 Then
studentLevel =
"Intermediate"
ElseIf examPercent > 70
And examPercent <= 100 Then
studentLevel =
"Advanced"
End If
Dim check5 As New
OleDb.OleDbDataAdapter("Select *
from tblExamInfo where ReviewerID =
'" & MainForm.lblReviewerID.Text &
"' and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d5 As New DataTable
check5.Fill(d5)
If Val(d5.Rows.Count) =
0 Then
Try
sql = "INSERT
INTO tblExamInfo (ReviewerID,
AssessmentNumber, ExamDate,
StudScore, ScorePercentage,
StudLevel, Category, Specialization)
VALUES ('" &
MainForm.lblReviewerID.Text & "','"
& MainForm.lblAssNum.Text & "','" &
Format(Now, "dd-MMM-yy") & "','" &
score & "','" & examPercent & "','"
& studentLevel & "','" &
txtCategory.Text & "','-')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i =
cmd.ExecuteNonQuery
If i > 0 Then
'MsgBox("Question Added",

MsgBoxStyle.Information, "Question
Information")
Else
MsgBox("Failed to add Question",
MsgBoxStyle.Critical, "Question
Information")
End If
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If

Imports System.Data.OleDb
Public Class Examination1
Private Sub Button9_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button9.Click
Me.Close()
End Sub
Private Sub Timer1_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Timer1.Tick

True

Me.Button5.Enabled =

Me.Close()
resultText = "You got "
& score & " out of " &
Me.txtNumQuestion.Text
With frmResult
.TextBox1.Text =
txtRevID.Text
.ShowDialog()
End With
'MsgBox("TIME'S UP!!!!
Your score is " & score & " out of "
& txtNumQuestion.Text & "")
End If
End Sub
End Class

lblsec.Text =
Val(lblsec.Text) - 1
End Sub
Private Sub
txtRevID_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
txtRevID.TextChanged
Dim check As New
OleDb.OleDbDataAdapter("Select *
from tblStudentInfo where
A_ReviewerID ='" & Me.txtRevID.Text
& "'", con)

Dim d1 As New DataTable


check.Fill(d1)
If d1.Rows.Count = 1 Then
Me.txtname.Text =
d1.Rows(0).Item("A_Name")
Me.txtCourse.Text =
d1.Rows(0).Item("A_Course")
Me.txtspec.Text =
d1.Rows(0).Item("A_Specialization")
End If
End Sub
Private Sub btna_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btna.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btna.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
txtPoint.Text = "1"
ElseIf btna.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btna.Text
'update answer
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "

& Val(QuestID.Text) & ",'" &


MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()

End Try
End If
End If

Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then

'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub btnb_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles btnb.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnb.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnb.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btnb.Text
'update answer

If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try

sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
End If
Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,

Specialization) VALUES (" &


Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception

MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub btnc_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles btnc.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnc.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnc.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"
End If
txtAns.Text = btnc.Text
'update answer
'update answer
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &

Val(txtQid.Text) & ",'" &


MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally

cmd.Dispose()

con.Close()
End Try
End If
End If

Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable

check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
End If
End If
End Sub
Private Sub btnd_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnd.Click
ConnectDB()
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If btnd.Text =
txtCorrectAnswer.Text Then
txtPoint.Text = "1"
ElseIf btnd.Text <>
txtCorrectAnswer.Text Then
txtPoint.Text = "0"

End If
txtAns.Text = btnd.Text
'update answer
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
Else
'update of answer
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer

Try

sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception
MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If

Else

Dim check2 As New


OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
Specialization ='" & txtspec.Text &
"' and AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,

Stud_Answer, Points, Category,


Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
Else
Dim check6 As New
OleDb.OleDbDataAdapter("select *
from tblStudentQuestion where
QuestionNumber = " & txtQid.Text & "
and ReviewerID = '" &
Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New
DataTable
check6.Fill(d1)
If
Val(d1.Rows.Count) = 1 Then
'update answer
Try
sql =
"UPDATE tblStudentQuestion SET
Stud_Answer = '" & _
Me.txtAns.Text & "', Points = " & _
txtPoint.Text & " WHERE
QuestionNumber = " &
Val(txtQid.Text) & " and ReviewerID
= '" & Me.txtRevID.Text & "' and
AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As
Integer
i =
cmd.ExecuteNonQuery
Catch ex As
Exception

MsgBox(ex.Message)

Finally

cmd.Dispose()

con.Close()
End Try
End If
End If
End If
End Sub

Private Sub Button5_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
Button5.Click
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
End If
Else
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where

ReviewerID = '" &


MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count = 0
Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection = con
cmd.CommandText =
"INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
End If
End If
Dim limit As Integer
limit =
Val(txtNumQuestion.Text)
If limit = Val(txtQid.Text)
Then
Button5.Enabled = False
ElseIf Val(txtQid.Text) <
limit Then
'GET ANOTHER QUESTION
lblmin.Text =
txtmin.Text
lblsec.Text =
txtsec.Text
txtQid.Text =
Val(txtQid.Text) + 1
End If
txtAns.Text = ""
End Sub
Private Sub
txtQid_TextChanged(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles
txtQid.TextChanged
' On Error Resume Next
If txtCategory.Text = "Prof.
Ed." Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& Val(txtQid.Text) & " and
AssessmentNum = '" &
txtAssessmentNum.Text & "' and
A_Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
QuestID.Text =
d1.Rows(0).Item("A_QuestionID")
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")
Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
End If
ElseIf txtCategory.Text =
"Gen. Ed." Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& Val(txtQid.Text) & " and
AssessmentNum = '" &
txtAssessmentNum.Text & "' and
A_Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
QuestID.Text =
d1.Rows(0).Item("A_QuestionID")
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")

Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")
'Me.txtAns.Text =
d1.Rows(0).Item("Stud_Answer")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
'Me.txtPoint.Text =
d1.Rows(0).Item("Points")
End If
ElseIf txtCategory.Text =
"Major" Then
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryGeneratedQuest where ID = "
& txtQid.Text & " and AssessmentNum
= '" & txtAssessmentNum.Text & "'
and A_Category ='" &
txtCategory.Text & "' and
A_Specialization ='" & txtspec.Text
& "'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count <> 0
Then
Me.txtQuestion.Text
= d1.Rows(0).Item("A_Question")
Me.txta.Text =
d1.Rows(0).Item("A_AnsA")
Me.txtb.Text =
d1.Rows(0).Item("A_AnsB")
Me.txtc.Text =
d1.Rows(0).Item("A_AnsC")
Me.txtd.Text =
d1.Rows(0).Item("A_AnsD")
'Me.txtAns.Text =
d1.Rows(0).Item("Stud_Answer")
Me.txtCorrectAnswer.Text =
d1.Rows(0).Item("A_CorrectAns")
'Me.txtPoint.Text =
d1.Rows(0).Item("Points")
End If
End If
End Sub
Private Sub
lblSec_TextChanged(ByVal sender As
Object, ByVal e As System.EventArgs)
Handles lblsec.TextChanged
If Val(txtNumQuestion.Text)
<> Val(txtQid.Text) And lblmin.Text
<> "0" And lblsec.Text = "0" Then

lblmin.Text =
Val(lblmin.Text) - 1
lblsec.Text = 59
ElseIf
Val(txtNumQuestion.Text) <>
Val(txtQid.Text) And lblmin.Text =
"0" And lblsec.Text = "0" Then
lblmin.Text =
txtmin.Text
lblsec.Text =
txtsec.Text
'save answer when time
is up per question
If Not con.State =
ConnectionState.Open Then
con.Open()
End If
If txtAns.Text = "" Then
txtAns.Text = "-"
txtPoint.Text = "0"
End If
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New
DataTable
check2.Fill(dt2)
If dt2.Rows.Count =
0 Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection =
con
cmd.CommandText
= "INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"

cmd.ExecuteNonQuery()
' con.Close()
End If
Else
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New
DataTable
check2.Fill(dt2)
If dt2.Rows.Count =
0 Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection =
con
cmd.CommandText
= "INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
End If
End If
txtQid.Text =
Val(txtQid.Text) + 1
txtAns.Text = ""
txtPoint.Text = "0"
End If
If Val(txtQid.Text) =
Val(txtNumQuestion.Text) And
lblmin.Text = "0" And lblsec.Text =
"0" Then
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("Select *

from tblStudentQuestion where


ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New
DataTable
check2.Fill(dt2)
If dt2.Rows.Count =
0 Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection =
con
cmd.CommandText
= "INSERT INTO tblStudentQuestion
(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','-')"
cmd.ExecuteNonQuery()
' con.Close()
End If
Else
Dim check2 As New
OleDb.OleDbDataAdapter("Select *
from tblStudentQuestion where
ReviewerID = '" &
MainForm.lblReviewerID.Text & "' and
QuestionNumber = " &
Val(txtQid.Text) & " and Category
='" & Me.txtCategory.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "'", con)
Dim dt2 As New
DataTable
check2.Fill(dt2)
If dt2.Rows.Count =
0 Then
Dim cmd As New
OleDb.OleDbCommand
cmd.Connection =
con
cmd.CommandText
= "INSERT INTO tblStudentQuestion

(QuestionNumber, ReviewerID,
QuestionID, AssessmentNumber,
Stud_Answer, Points, Category,
Specialization) VALUES (" &
Val(txtQid.Text) & ",'" &
MainForm.lblReviewerID.Text & "', "
& Val(QuestID.Text) & ",'" &
MainForm.lblAssNum.Text & "','" &
Me.txtAns.Text & "'," &
Val(txtPoint.Text) & ", '" &
Me.txtCategory.Text & "','" &
txtspec.Text & "')"
cmd.ExecuteNonQuery()
' con.Close()
End If
End If
Timer1.Enabled = False
If txtCategory.Text <>
"Major" Then
totScoreEd()
Else
totScoreMajor()
End If
End If
End Sub
Private Sub Button7_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Button7.Click
If txtCategory.Text <>
"Major" Then
totScoreEd()
Else
totScoreMajor()
End If
End Sub
Private Sub totScoreEd()
Dim score As Integer
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryTotalScore where ReviewerID
='" & Me.txtRevID.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count = 1 Then
score =
d1.Rows(0).Item("SumOfPoints")
lblsec.Text = "0"

resultText = "Your score


is " & score & " out of " &
txtNumQuestion.Text & ""
examPercent = (score /
Val(txtNumQuestion.Text)) * 100
If examPercent <= 50
Then
studentLevel =
"Beginner"
ElseIf examPercent > 50
And examPercent <= 70 Then
studentLevel =
"Intermediate"
ElseIf examPercent > 70
And examPercent <= 100 Then
studentLevel =
"Advanced"
End If
Dim check5 As New
OleDb.OleDbDataAdapter("Select *
from tblExamInfo where ReviewerID =
'" & MainForm.lblReviewerID.Text &
"' and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text &
"'", con)
Dim d5 As New DataTable
check5.Fill(d5)
If Val(d5.Rows.Count) =
0 Then
Try
sql = "INSERT
INTO tblExamInfo (ReviewerID,
AssessmentNumber, ExamDate,
StudScore, ScorePercentage,
StudLevel, Category, Specialization)
VALUES ('" &
MainForm.lblReviewerID.Text & "','"
& MainForm.lblAssNum.Text & "','" &
Format(Now, "dd-MMM-yy") & "','" &
score & "','" & examPercent & "','"
& studentLevel & "','" &
txtCategory.Text & "','-')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i =
cmd.ExecuteNonQuery
If i > 0 Then
'MsgBox("Question Added",
MsgBoxStyle.Information, "Question
Information")
Else

MsgBox("Failed to add Question",


MsgBoxStyle.Critical, "Question
Information")
End If
Catch ex As
Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
Me.Button5.Enabled =
True

Me.Close()
resultText = "You got "
& score & " out of " &
Me.txtNumQuestion.Text
With frmResult
.TextBox1.Text =
txtRevID.Text
.ShowDialog()
End With
'MsgBox("TIME'S UP!!!!
Your score is " & score & " out of "
& txtNumQuestion.Text & "")
End If
End Sub
Private Sub totScoreMajor()
Dim score As Integer
Dim check As New
OleDb.OleDbDataAdapter("Select *
from qryTotalScore where ReviewerID
='" & Me.txtRevID.Text & "' and
AssessmentNumber ='" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d1 As New DataTable
check.Fill(d1)
If d1.Rows.Count = 1 Then
score =
d1.Rows(0).Item("SumOfPoints")
lblsec.Text = "0"
resultText = "Your score
is " & score & " out of " &
txtNumQuestion.Text & ""
examPercent = (score /
Val(txtNumQuestion.Text)) * 100
If examPercent <= 50
Then

"Beginner"

studentLevel =

ElseIf examPercent > 50


And examPercent <= 70 Then
studentLevel =
"Intermediate"
ElseIf examPercent > 70
And examPercent <= 100 Then
studentLevel =
"Advanced"
End If
Dim check5 As New
OleDb.OleDbDataAdapter("Select *
from tblExamInfo where ReviewerID =
'" & MainForm.lblReviewerID.Text &
"' and AssessmentNumber = '" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)
Dim d5 As New DataTable
check5.Fill(d5)
If Val(d5.Rows.Count) =
0 Then
Try
sql = "INSERT
INTO tblExamInfo (ReviewerID,
AssessmentNumber, ExamDate,
StudScore, ScorePercentage,
StudLevel, Category, Specialization)
VALUES ('" &
MainForm.lblReviewerID.Text & "','"
& MainForm.lblAssNum.Text & "','" &
Format(Now, "dd-MMM-yy") & "','" &
score & "','" & examPercent & "','"
& studentLevel & "','" &
txtCategory.Text & "','-')"
ConnectDB()
cmd = New
OleDbCommand(sql, con)
Dim i As Integer
i =
cmd.ExecuteNonQuery
If i > 0 Then
'MsgBox("Question Added",
MsgBoxStyle.Information, "Question
Information")
Else
MsgBox("Failed to add Question",
MsgBoxStyle.Critical, "Question
Information")
End If

Exception

Catch ex As

MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End If
Me.Button5.Enabled =
True
Me.Close()
resultText = "You got "
& score & " out of " &
Me.txtNumQuestion.Text
With frmResult
.TextBox1.Text =
txtRevID.Text
.ShowDialog()
End With
'MsgBox("TIME'S UP!!!!
Your score is " & score & " out of "
& txtNumQuestion.Text & "")
End If
End Sub
Private Sub
txtCategory_TextChanged(ByVal sender
As System.Object, ByVal e As
System.EventArgs) Handles
txtCategory.TextChanged
If txtCategory.Text <>
"Major" Then
Dim check2 As New
OleDb.OleDbDataAdapter("select *
from tblGeneratedQuestion where
AssessmentNum='" &
MainForm.lblAssNum.Text & "' and
Category='" & txtCategory.Text &
"'", con)
Dim dt2 As New DataTable
check2.Fill(dt2)
If dt2.Rows.Count <> 0
Then
txtNumQuestion.Text
= dt2.Rows.Count
End If
Else
Dim check2 As New
OleDb.OleDbDataAdapter("select *
from tblGeneratedQuestion where
AssessmentNum='" &
MainForm.lblAssNum.Text & "' and
Category ='" & txtCategory.Text & "'
and Specialization ='" &
txtspec.Text & "'", con)

Then

Dim dt2 As New DataTable


check2.Fill(dt2)
If dt2.Rows.Count <> 0
txtNumQuestion.Text

= dt2.Rows.Count

End If
End If
End Sub
End Class

36. Click this Button to generate the questions.


37. Click this button to print the generated questions.
38. Click this button to exit.

39

40

39. Click this button to search for the assessment log of


the reviewers.
40. Click this Button to exit.

41

43

41. Click this button to view Individual result.


42. Click this button to exit.

43. Click this button to view Summary Result.


44. Click this button to exit.

42

44

Вам также может понравиться