ONLINE QUIZ in VB



AIM:
           Create on Online Quiz in Visual Basic 6.0
PROCEDURE:
Step 1: create a standard exe project.
Step 2: Design command buttons, textboxes, labels and option buttons. The option          button is control Array.
Step 3: On the form load event the timer is enabled and only the Question or One frame should be visible to the student.
Step 4: On the timer event the time should be decremented by one and also display the remaining Time in the textbox. When the time became Zero the timer is disables.
Step 5: On the Click event of the each frame the next frame should be visible and the current frame should be Invisible. If the answer is correct then increment the score
Step 6: On the click of end command button end the program.




SOURCE CODE:
Dim mark  As Integer
Private Sub Command1_Click()
Me.Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Form1.Visible = False
Form2.Show
Form2.Command2.Caption = "END"
Form2.Command1.Visible = False
Form2.Frame1.Visible = True
Form2.Text4.Text = Val(Text1.Text)
End Sub

Private Sub Form_Load()
Me.Timer1.Enabled = True
Text1.Text = "0"
End Sub

Private Sub OP3_Click(Index As Integer)
If OP3(1).Value = True Then
mark = mark + 1
Text1.Text = mark
MsgBox ("CONGRATS!"), vbInformation
Else
MsgBox ("ANSWER IS WRONG"), vbCritical
End If
Me.Frame2.Visible = False
Frame3.Visible = True
Timer2.Enabled = False
Timer3.Enabled = True
Text2.Text = 10
End Sub

Private Sub Option3_Click(Index As Integer)
If Option3(0).Value = True Then
mark = mark + 1
Text1.Text = mark
MsgBox ("CONGRATS!"), vbInformation
Else
MsgBox ("ANSWER IS WRONG"), vbCritical
End If
Timer3.Enabled = False
Form1.Visible = False
Form2.Show
Form2.Command2.Visible = False
Form2.Command2.Caption = "END"
Form2.Frame1.Visible = True
Form2.Text4.Text = Val(Text1.Text)
End Sub

Private Sub Option4_Click(Index As Integer)
If Option4(1).Value = True Then
mark = mark + 1
Text1.Text = mark
MsgBox ("CONGRATS!"), vbInformation
Else
MsgBox ("ANSWER IS WRONG"), vbCritical
End If
Frame1.Visible = False
Frame2.Visible = True
Text2.Text = 10
Timer1.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer1_Timer()
If Text2.Text > 0 Then
Text2.Text = Val(Text2.Text) - 1
Else
Text2.Text = 10
Timer1.Enabled = False
Timer2.Enabled = True
MsgBox ("OVERTIME"), vbInformation
Me.Frame1.Visible = False
Me.Frame2.Visible = True
End If
End Sub

Private Sub Timer3_Timer()
If Text2.Text > 0 Then
Text2.Text = Val(Text2.Text) - 1
Else
Text2.Text = "END"
Timer3.Enabled = False
MsgBox ("OVERTIME"), vbCritical
Form1.Visible = False
Form2.Show
Form2.Command2.Visible = False
Form2.Command2.Caption = "END"
Form2.Frame1.Visible = True
Form2.Text4.Text = Val(Text1.Text)
End If
End Sub

Private Sub Timer2_Timer()
If Text2.Text > 0 Then
Text2.Text = Val(Text2.Text) - 1
Else
Text2.Text = 10
Timer2.Enabled = False
Timer3.Enabled = True
Form2.Command2.Caption = "END"
MsgBox ("OVERTIME"), vbInformation
Me.Frame2.Visible = False
Me.Frame3.Visible = True
End If
End Sub
Private Sub Command1_Click()
Form2.Visible = False
Form1.Show
End Sub



             

















               







               


0 comments: