I am making a quiz as part of my assignment for my computer science class and the aim is to make a flash quiz where keywords and their definitions are loaded in from text files. From previous recommendations on Daniweb I have created an associative array. I import the two files like so:
Public Keywords As String() = IO.File.ReadAllLines("C:\Users\Matt\Documents\keywords.txt")
Public Definitions As String() = IO.File.ReadAllLines("C:\Users\Matt\Documents\definitions.txt")
My dictionary looks like this:
Dim Dict As New Dictionary(Of String, String)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dict.Add(Keywords(0), Definitions(0))
Dict.Add(Keywords(1), Definitions(1))
Dict.Add(Keywords(2), Definitions(2))
Dict.Add(Keywords(3), Definitions(3))
Dict.Add(Keywords(4), Definitions(4))
Dict.Add(Keywords(5), Definitions(5))
Dict.Add(Keywords(6), Definitions(6))
Dict.Add(Keywords(7), Definitions(7))
Dict.Add(Keywords(8), Definitions(8))
Dict.Add(Keywords(9), Definitions(9))
Dict.Add(Keywords(10), Definitions(10))
Dict.Add(Keywords(11), Definitions(11))
Dict.Add(Keywords(12), Definitions(12))
Dict.Add(Keywords(13), Definitions(13))
Dict.Add(Keywords(14), Definitions(14))
LabelKeyword.Text = Dict(KeyArray)
RadioButtonDef1.Text = Dict(DefArray)
RadioButtonDef2.Text = Dict(DefArray2)
RadioButtonDef3.Text = Dict(KeyArray3)
End Sub
My randomize looks like this:
Dim Rand As New Random()
Dim KeyIndex As Integer = Rand.Next(0, Keywords.Length - 1)
Dim KeyArray As String = Keywords(KeyIndex)
Dim DefIndex As Integer = Rand.Next(0, Definitions.Length - 1)
Dim DefArray = Definitions(DefIndex)
Dim KeyIndex2 As Integer = Rand.Next(0, Keywords.Length - 1)
Dim KeyArray2 As String = Keywords(KeyIndex2)
Dim DefIndex2 As Integer = Rand.Next(0, Definitions.Length - 1)
Dim DefArray2 As String = Definitions(DefIndex2)
Dim KeyIndex3 As Integer = Rand.Next(0, Keywords.Length - 1)
Dim KeyArray3 As String = Keywords(KeyIndex3)
Dim DefIndex3 As Integer = Rand.Next(0, Definitions.Length - 1)
Dim DefArray3 = Definitions(DefIndex3)
Dim rounds As Integer = 0
The issue I am facing is the next requirement which is:
- Once the user has successfully matched the keywords to the correct definition twice the option should not appear again and when all are complete twice the quiz ends and displays time taken.
I can't seem to figure out how to tell the program how to check the correct keyword to the correct definition when it is randomized.
Any help will be greatly appreciated.