this is tha fuction and i want its validation.
validation funtion
Public Function runquiz() Dim qDice As New Random Dim qcount As Integer qcount = qDice.Next(1, 5) Try If t <= nq - 1 Then //t is counter for questions Timer1.Enabled = True If con.State = ConnectionState.Open Then con.Close() con.Open() Dim adp As New OleDbDataAdapter("select * from it", con) Dim ds As New DataSet Dim adpgkd As New OleDbDataAdapter("select * from itd", con) // table1 ' Dim adpgkd1 As New OleDbDataAdapter("select * from gkd", con) //table2 'Dim dsgdk As New DataSet If nq = 5 Then // nq is no of question adpgkd.Fill(ds) Dim dt As DataTable dt = ds.Tables(0) qbox.Text = dt.Rows(qcount).Item(1) optiona.Text = dt.Rows(qcount).Item(2) optionb.Text = dt.Rows(qcount).Item(3) optionc.Text = dt.Rows(qcount).Item(4) optiond.Text = dt.Rows(qcount).Item(5) t = t + 1 con.Close() Else qcount = qDice.Next(1, 5) If t >= 3 Then qcount = qDice.Next(4, 11) End If adp.Fill(ds) Dim dt As DataTable dt = ds.Tables(0) qbox.Text = dt.Rows(qcount).Item(1) optiona.Text = dt.Rows(qcount).Item(2) optionb.Text = dt.Rows(qcount).Item(3) optionc.Text = dt.Rows(qcount).Item(4) optiond.Text = dt.Rows(qcount).Item(5) t = t + 1 con.Close() End If Else Timer1.Enabled = False qbox.Text = "Question" optiona.Text = "Option A" optionb.Text = "Option B" optionc.Text = "Option C" optiond.Text = "Option D" Button1.Enabled = True MsgBox("Thanks for Participation : " & namebox.Text & vbCrLf & "Your score is : " & scorebox.Text, MsgBoxStyle.Information, "Completed") End If Catch ex As Exception MsgBox(ex.Message) End Try End Function
validation funtion
Public Function validans() Dim scr As Integer If qcount = 1 And optiona.Checked Or qcount = 2 And optiona.Checked Or qcount = 3 And optiona.Checked Or qcount = 4 And optionb.Checked Or qcount = 5 And optionc.Checked Then scr = scorebox.Text + 1 scorebox.Text = scr ElseIf qcount = 6 And optionb.Checked Or qcount = 7 And optiona.Checked Or qcount = 8 And optiond.Checked Or qcount = 9 And optionb.Checked Or qcount = 10 And optiona.Checked Or qcount = 11 And optionb.Checked Then scr = scorebox.Text + 1 scorebox.Text = scr End If End Function
Last edited by a moderator: