I am making a quiz for my computer science class and the basic concept is that you have 15 keywords and 15 definitions. All need to be randomly displayed and the correct answer has to appear. The user has to match the correct definition to the keyword twice and then that keyword and definition are not displayed again. When all have been answered twice the quiz is over.
I have stored both my keywords and my definitions in the same file so they don't get out of sync. The text file looks like so:
Keyword1 = Definition1
Keyword2 = Definition2
Keyword3 = Definition3
etc (Total of 15)
My main form looks like this:
Public Class quiz
Private Sub quiz_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myBase.Load
Dim MyList As List(Of KeyValuePair(Of String, String)) = New List(Of String, String))
For Each line As String In System.IO.File.ReadAllLines("my-file-path")
Dim Pair() As String = line.split("=")
mylist.add(New KeyValuePair(Of String, String)(Pair(0), Pair(1)))
Next
I am displaying the random keyword in a label and the definitions in radiobuttons. Two need to be random definitions and one has to be the correct definition to the keyword shown, which also needs to be displayed randomly.
What I am asking is:
- How do I finish this list off as it is overwriting the other 15 lines only using the last one?
- How can I randomize the list of keywords and definitions for when they are displayed?
- How can I remove the items when each keyword has been matched to its definition twice? E.G: Keyword 1 and definition 1 have been answered correctly twice so remove from list so it won't be displayed again.