First of all-I will guarantee I will mark the thread as solved when you kind people have helped me to solve the problem.
Ok well Ive got a project which is to make a Quizzing System for my school using a database. It is a multiple choice quiz (so only 1 out of the 4 answer is right for that one question - and so only need to check that the student has chosen the right answer).Ive spent quite alot of time trying to think how to do the project, but I think I need some advice from more experienced programmers (you):icon_smile:.....Well I can show you how I want the system to work in a kind of flow diagram (easier for you to understand).
The Student logs into the system--> Student chooses what test they want to take (taken from Database).-->Program loads the question from the database onto the screen (I've got this working by displaying the questions using text boxes)-->The problem is saving the answer the student thinks it is (I was thinking that I could just keep adding 1 to a textbox/array and then save the value to the database?).
So basically my problem is that I cant figure how I should what the user thinks the answer is (should I use Radio buttons or Checkboxes?) Reading other peoples threads I realised that I should include my database structures...I will attach the pictures of my current quizzing system and pictures of my database including relationship diagram.
Ok heres the code for screen that the Student looks at..
Public Class StudentQuestions
Dim inc As Integer
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim Questions As String
Dim radio As String
Dim i As Integer
Private Sub NavigatingDatabaseRecords_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "PROVIDER=Microsoft.JET.OLEDB.4.0;Data Source = D:\Work\Computing\Computing CourseWork\The Quiz DataBase.mdb"
con.Open()
sql = "Select * from tblQuestions"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "The Quiz DataBase")
con.Close()
MaxRows = ds.Tables("The Quiz DataBase").Rows.Count
inc = -1
End Sub
Private Sub NavigateRecords()
txtQuestion.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("Question")
txtAnswer1.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("A1")
txtAnswer2.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("A2")
txtAnswer3.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("A3")
txtAnswer4.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("A4")
txtCorrectAnswer.Text = ds.Tables("The Quiz DataBase").Rows(inc).Item("CorrectAnswer")
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
NavigateRecords()
Else
MsgBox("No more questions.")
End If
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
ElseIf inc = -1 Then
MsgBox("No Records Yet")
ElseIf inc = 0 Then
MsgBox("First Record")
End If
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
End If
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
End If
End Sub
This code is for the 1st picture/attachment. (called StudentQuestions)
---------------
The Database Table names are
| tblQuestions | tblResult | tblStudentLogin| tblStudents | tblTeacherLogin | tblTechnicianLogin | tblTest | Test2Qs |
Thankyou, quick replys would be appreciated..and If you want to know anything else or want me to upload please tell me. :icon_smile: