Thanks to all the programmers out here I had a successful school project. Thank you again.
But now I want to carry the same idea into making a desktop exam application. I tried it on my own but I kept on getting stuck.
1. Because I figured i used session states in the web application.
2. Because I also figured there is no radio button-list equivalent in VB.net just radio button.
Below is a sample of the code I am using for the desktop exam application. Hope from there I will received the best of helps.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.TabStop = False
RadioButton2.TabStop = False
RadioButton3.TabStop = False
RadioButton4.TabStop = False
Hour = 1
minute = 0
seconds = 0
time.Text = Hour.ToString() & ":" & minute.ToString & ":" & seconds.ToString
Dim a(4), t As Integer
cnn.Open()
cmd.Connection = cnn
Dim arbit As New Random
Randomize()
Dim I As Integer = 0
While I <= 3
t = arbit.Next(1, 25)
If Array.IndexOf(a, t) = -1 Then
a(I) = t
I += 1
End If
End While
For I = 0 To 4
cmd.CommandText = "SELECT * FROM tblExamsQuestion where serial =" & a(I)
adp = New SqlDataAdapter(cmd.CommandText, cnn)
adp.Fill(ds, "tblExamsQuestionda")
Next
dt = New DataTable("Answered")
dt.Columns.Add("Serial", GetType(Integer))
dt.Columns.Add("question", GetType(String))
dt.Columns.Add("choice1", GetType(String))
dt.Columns.Add("choice2", GetType(String))
dt.Columns.Add("choice3", GetType(String))
dt.Columns.Add("choice4", GetType(String))
dt.Columns.Add("correct", GetType(String))
dt.Columns.Add("selected", GetType(String))
Dim r As DataRow
For Each r In ds.Tables("tblExamsQuestionda").Rows
dr = dt.NewRow
dr("Serial") = dt.Rows.Count + 1
dr("question") = r.Item("question")
dr("choice1") = r.Item("choice1")
dr("choice2") = r.Item("choice2")
dr("choice3") = r.Item("choice3")
dr("choice4") = r.Item("choice4")
dr("correct") = r.Item("correct")
dr("selected") = ""
dt.Rows.Add(dr)
Next
session = dt
Call _show()
If ctr = 0 Then
BtnPrev.Enabled = False
End If
If ctr = 4 Then
BtnNext.Enabled = False
End If
cnn.Close()
End Sub
Sub _show()
dt = session
Dim l As Label
l = Label1
l.Text = dt.Rows(ctr).Item("Serial") & "."
l = Label2
l.Text = dt.Rows(ctr).Item("question")
Dim r As RadioButton
r = RadioButton1
r.Text = (dt.Rows(ctr).Item("choice1"))
r = RadioButton2
r.Text = (dt.Rows(ctr).Item("choice2"))
r = RadioButton3
r.Text = (dt.Rows(ctr).Item("choice3"))
r = RadioButton4
r.Text = (dt.Rows(ctr).Item("choice4"))
Session_ctr = ctr
End Sub
I hope with this I can get the best of helps. Help me to make the web application a desktop application