txtSystemAnswer.Text = ""
lblUserName.Text = "John Doe"
lblExamineeName.Text = "Charlie Brown's A Dummy"
'Put user code to initialize the page here
Dim sysAnswer As String
Dim usAnswer As String
Dim TrackQuestNum As Integer
'lblTrackNum.Text = TrackQuestNum 'Assign Tracking num to lblTrackNum
'Receive PK/Index for WHERE STATEMENT
'Me.ReceivingIndex = Val(A_form.ReceivedIndex)
Me.ReceivingIndex = 1 'This holds ForeignKey value!
'Me.InitializeComponent()
'Call RadioButton Blanking
Me.BlankOutRadio()
Try
Me.SqlConnection1.Open()
'Me.SqlSelectCommand1.CommandText = "Select * From TBL_ExamQuestions WHERE ExamID = ' " & iRecievedIndex & " ' AND QuestionNum = ' " & thispage & " ' ORDER BY QuestionID ASC"
Me.SqlSelectCommand1.CommandText = "Select * From TBL_ExamQuestions WHERE ExamID = ' " & ReceivingIndex & " ' ORDER BY QuestionNum ASC"
'
Me.DataSet111.Tables("TBL_ExamQuestions").Clear()
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.Fill(Me.DataSet111, "TBL_ExamQuestions")
Me.DataSet111.Clear()
Me.SqlDataAdapter1.Fill(DataSet111)
Me.lblQuestNo.DataBind()
Me.TextBox1.DataBind() 'QuestionBox
Me.lblSystemAnswer.DataBind()
Me.txtSystemAnswer.DataBind()
Me.RadioButton1.DataBind()
Me.RadioButton2.DataBind()
Me.RadioButton3.DataBind()
Me.RadioButton4.DataBind()
Me.CheckRadioButtons()
theSystemAnswer = Val(lblSystemAnswer.Text)
theUserAnswer = Val(MyChoice)
'Save Data on temp ViewStates
ViewState("CybertronAnswer") = theSystemAnswer 'SysetmAnswer!
ViewState("OmegatronAnswer") = theUserAnswer 'UserAnswer
ViewState("TotalQuestion") = intTotalQuestion
ViewState("Score") = intScore
ViewState("QuestionNo") = intQuestionNo
'ViewState("AnswerHistory") = arrAnswerHistory
Me.txtSystemAnswer.Text = theSystemAnswer
Catch ex As Exception
' No code YET!
Finally
End Try
End Sub
Public Sub btnNextQuest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNextQuest.Click
Dim abc As String
Dim index As Integer
Dim TrackQuestNum As Integer
Dim ThisScore As Integer
theSystemAnswer = ViewState("CybertronAnswer")
theUserAnswer = ViewState("OmegatronAnswer")
intTotalQuestion = ViewState("TotalQuestion")
intScore = ViewState("Score")
intQuestionNo = ViewState("QuestionNo")
'arrAnswerHistory = ViewState("AnswerHistory")
If theUserAnswer = theUserAnswer Then
Me.lblUserName.Text = "Something went in!"
Application.Item("ThisScore") = Application.Item("ThisScore") + ThisScore
Me.lblYourScore.Text = Application.Item("ThisScore")
Else
Me.lblUserName.Text = "Its not equal"
End If
Me.ShowNextQuestion(intQuestionNo) 'Load next question!
Me.BlankOutRadio() 'Call RadioButton Blanking!
End Sub
Public Sub ShowNextQuestion(ByVal intQuestionNo As Integer)
Dim abc As String
Dim index As Integer
Dim TrackQuestNum As Integer
Dim usAnswer As String
Dim sysAnswer As String
If theUserAnswer = theUserAnswer Then
Me.lblUserName.Text = "Something went in!"
Application.Item("ThisScore") = Application.Item("ThisScore") + thisScore
Me.lblYourScore.Text = Application.Item("ThisScore")
Else
Me.lblUserName.Text = "Its not equal"
End If
index = Me.ViewState("index")
index += 1
If index > DataSet111.Tables(0).Rows.Count - 1 Then
index = DataSet111.Tables(0).Rows.Count - 1
'index = 0
End If
Me.ViewState("index") = index 'stores the number to viewstate
abc = DataSet111.Tables(0).Rows(index).Item("TheQuestion")
DataView1.Sort = "QuestionNum"
DataView1.RowFilter = "TheQuestion='" & abc & "'"
Me.TextBox1.DataBind()
Me.lblQuestNo.DataBind()
Me.txtSystemAnswer.DataBind()
Me.lblSystemAnswer.DataBind()
Me.RadioButton1.DataBind()
Me.RadioButton2.DataBind()
Me.RadioButton3.DataBind()
Me.RadioButton4.DataBind()
Do
ViewState("CybertronAnswer") = theSystemAnswer
ViewState("TotalQuestion") = intTotalQuestion
ViewState("Score") = intScore
ViewState("QuestionNo") = intQuestionNo
Loop While (ViewState("index") = index)
End Sub
Sub CheckRadioButtons()
'Check Radio Button Inputs!!!!
' Me.ViewState("Ans1") = ans1
' Me.ViewState("Ans2") = ans2
If RadioButton1.Checked Then
Me.lblYourAnswer.Text = "A"
MyChoice = "A"
ElseIf RadioButton2.Checked Then
Me.lblYourAnswer.Text = "B"
MyChoice = "B"
ElseIf RadioButton2.Checked Then
Me.lblYourAnswer.Text = "C"
MyChoice = "C"
ElseIf RadioButton2.Checked Then
Me.lblYourAnswer.Text = "D"
MyChoice = "D"
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If Page.IsPostBack Then
MyChoice = "A"
Me.lblYourAnswer.Text = "A"
Me.thisUserAnswer = Me.lblYourAnswer.Text
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
MyChoice = "B"
Me.lblYourAnswer.Text = "B"
Me.thisUserAnswer = Me.lblYourAnswer.Text
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
MyChoice = "C"
Me.lblYourAnswer.Text = "C"
Me.thisUserAnswer = Me.lblYourAnswer.Text
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
MyChoice = "D"
Me.lblYourAnswer.Text = "D"
Me.thisUserAnswer = Me.lblYourAnswer.Text
End Sub
Sub BlankOutRadio()
'Blank-Out the RadioButtons!
Me.RadioButton1.Checked = False
Me.RadioButton2.Checked = False
Me.RadioButton3.Checked = False
Me.RadioButton4.Checked = False
End Sub
This post has been edited by bryanarzaga: 09 October 2007 - 02:32 PM

New Topic/Question
Reply




MultiQuote



|