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
...

Thanks to the help from others on StackOverflow I have managed to get the randomising completed. For reference that looks like this:

Answer Class:

 Public Class Answer
    Public Answer As String
    Public Answered As Boolean
End Class

Main form:

Public Class Form1
    Private kv As Dictionary(Of String, Answer) 'Define kv as a dictionary
    Private keyword As String
    Private correctDefinition As String
    Const NUMBER_OF_ANSWERS As Integer = 3 'Define the constant NUMBER_OF_ANSWERS

    Private Sub RandomiseAnswers()
        Dim r As New Random
        Dim kvRandom As List(Of KeyValuePair(Of String, Answer)) =
          kv.OrderBy(Function() r.Next).ToList

        'questions will appear in random order
        For Each line As KeyValuePair(Of String, Answer) In kvRandom
            Dim keyword As String = line.Key
            Dim correctDefinition As String = line.Value.Answer

            Dim keywords As New List(Of String)
            keywords.Add(keyword)
            keywords.AddRange(kv.Keys.Except({keyword}).
              OrderBy(Function() r.Next).Take(NUMBER_OF_ANSWERS - 1))

            Dim definitionsRandom As List(Of String) =
               keywords.Select(Function(x) kv(x).Answer).OrderBy(Function() r.Next).ToList

            LabelKeyword.Text = keyword
            RadioButtonDef1.Text = definitionsRandom(0)
            RadioButtonDef2.Text = definitionsRandom(1)
            RadioButtonDef3.Text = definitionsRandom(2)
        Next
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'The text file is structured like so:
        'Keyword1,Definition1
        'Keyword2,Definition2
        'Keyword3,Defintion3
        '...
        'This makes sure that the keywords and the definitions do not get out of sync when randomising, as a dictionary is a key-value data structure. Call the key, get the right value etc.
        kv = New Dictionary(Of String, Answer) 'kv = a new dictionary
        For Each line As String In IO.File.ReadAllLines("C:\Users\Matt\Documents\keywords.txt") 'Foreach loop populating the dictionary from the text file
            Dim parts() As String = line.Split(",") 'Split the Keywords from the definitions where the , is
            kv.Add(parts(0), New Answer With {.Answer = parts(1), .Answered = False}) 'Add the two parts (Keyword and Definition) to the Parts with the Answer class
        Next

        Dim r As New Random 'Define r as new random
        Dim kvRandom As List(Of KeyValuePair(Of String, String)) =
          kv.OrderBy(Function() r.Next) _
    .Select(Function(x) New KeyValuePair(Of String, String)(x.Key, x.Value.Answer)) _
    .ToList() 'A Select method to convert the items in the list properly

        'questions will appear in random order
        For Each line As KeyValuePair(Of String, String) In kvRandom
            Dim keyword As String = line.Key
            Dim correctDefinition As String = line.Value 'Checks that the correct definition will be displayed when its keyword is randomly displayed.

            'Define keywords as a new list
            Dim keywords As New List(Of String)
            keywords.Add(keyword) 'Adds the keyword to the list as the Part(0) from the text file in the first loop
            keywords.AddRange(kv.Keys.Except({keyword}).
              OrderBy(Function() r.Next).Take(NUMBER_OF_ANSWERS - 1))

            Dim definitionsRandom As List(Of String) =
              keywords.Select(Function(x) kv(x).Answer).OrderBy(Function() r.Next).ToList 'Define definitionsRandom as a list. Checks against correctDefinition to know to always display the correct answer as one of the 
            'random definitions

            LabelKeyword.Text = keyword 'Randomly display a keyword
            RadioButtonDef1.Text = definitionsRandom(0) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
            RadioButtonDef2.Text = definitionsRandom(1) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
            RadioButtonDef3.Text = definitionsRandom(2) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
        Next

    End Sub



    Private Sub ButtonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNext.Click
        'If (RadioButtonDef1.Checked And RadioButtonDef1.Text = correctDefinition) Or (RadioButtonDef2.Checked And RadioButtonDef2.Text = correctDefinition) Or (RadioButtonDef3.Checked And RadioButtonDef3.Text = correctDefinition) Then
        '    If kv(keyword).Answered Then
        '        kv.Remove(keyword)
        '    Else
        '        kv(keyword).Answered = True
        '    End If
        'Else
        '    MsgBox("Incorrect Answer!")
        'End If
        If (RadioButtonDef1.Checked And RadioButtonDef1.Text = correctDefinition) Or (RadioButtonDef2.Checked And RadioButtonDef2.Text = correctDefinition) Or (RadioButtonDef3.Checked And RadioButtonDef3.Text = correctDefinition) Then
            MsgBox("Correct Answer")
        Else
            MsgBox("Incorrect Answer. The correct answer is: " & correctDefinition)
        End If
    End Sub
End Class

I use a subroutine in my buttonNext_click to prevent duplicate code, as you can see above Private Sub RandomiseAnswers().

my issue however is when I come down to the If/else statement where I determine whether the user has selected the correct answer. As you can see I have commented out the original line as I found that it didn't work, and therefore I created one which would display a message box. By using that If/Else statement I have found that it always displays the Incorrect Answer message box and it doesn't display the correct definition.

What is puzzling me the most is that I know that correctDefinition works as it will always display the correct definition to the current keyword however I cannot seem to fathom out how to make it work in the conditional/s.

Does anyone have a possible solution as to why it doesn't seem to like being used in the If/Else statement/s but does work when randomising.

Sorry if it is hard to understand what I am asking.

I have not found any way around this, so help will be greatly appreciated.

Edited 2 Years Ago by Kent55

Your declaration should be

kv = New Dictionary(Of String, String)

You should probably be using something like "=" for a separator because a comma might appear in a definition.

If you use a common handler for the radio buttons you won't need to use a complex If statement. For example

Private Sub radDef1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged

    Dim rad As RadioButton = sender

    'Because this event triggers when a radiobutton is
    'deselected as well as selected, we only want to process
    'the SELECTED event. Also, one radio button will be
    'selected automatically. If you start with the label
    '(which displays the word) being blank then you can
    'ignore the initial SELECTED even on form load.

    If rad.Checked And lblWord.Text <> "" Then
        If rad.Text = myDict(lblWord.Text) Then
            'the answer is correct
        Else
            'the answer is incorrect
        End If
    End If

    'remove the word from the quiz (dictionary)

    'if there are more words left then
    '   display the next question
    'else
    '   the quiz is over
    'end if

End Sub

Thanks I tried what you suggested but I still have the same error. My problem is that correctDefinition equals line.value so I don't understand why when the keywords are randomised as line.key it doesn't check that they are a pair? It is reading correctDefinition as null. Do you have any possible fixes for this issue?

Thanks again.

Edited 2 Years Ago by Kent55

Public Class Form1
    Private kv As Dictionary(Of String, String) 'Define kv as a dictionary
    Private keyword As String
    Private correctDefinition As String
    Const NUMBER_OF_ANSWERS As Integer = 3 'Define the constant NUMBER_OF_ANSWERS
    Private Sub RandomiseAnswers()
        Dim r As New Random
        Dim kvRandom As List(Of KeyValuePair(Of String, String)) =
          kv.OrderBy(Function() r.Next).ToList
        'questions will appear in random order
        For Each line As KeyValuePair(Of String, String) In kvRandom
            Dim keyword As String = line.Key
            Dim correctDefinition As String = line.Value
            Dim keywords As New List(Of String)
            keywords.Add(keyword)
            keywords.AddRange(kv.Keys.Except({keyword}).
              OrderBy(Function() r.Next).Take(NUMBER_OF_ANSWERS - 1))
            Dim definitionsRandom As List(Of String) =
               keywords.Select(Function(x) kv(x)).OrderBy(Function() r.Next).ToList
            LabelKeyword.Text = keyword
            RadioButtonDef1.Text = definitionsRandom(0)
            RadioButtonDef2.Text = definitionsRandom(1)
            RadioButtonDef3.Text = definitionsRandom(2)
        Next
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'The text file is structured like so:
        'Keyword1,Definition1
        'Keyword2,Definition2
        'Keyword3,Defintion3
        '...
        'This makes sure that the keywords and the definitions do not get out of sync when randomising, as a dictionary is a key-value data structure. Call the key, get the right value etc.
        kv = New Dictionary(Of String, String) 'kv = a new dictionary
        For Each line As String In IO.File.ReadAllLines("C:\Users\Matt\Documents\keywords.txt") 'Foreach loop populating the dictionary from the text file
            Dim parts() As String = line.Split(",") 'Split the Keywords from the definitions where the , is
            kv.Add(parts(0), parts(1)) 'Add the two parts (Keyword and Definition) to the Parts with the Answer class
        Next
        Dim r As New Random 'Define r as new random
        Dim kvRandom As List(Of KeyValuePair(Of String, String)) =
          kv.OrderBy(Function() r.Next) _
    .Select(Function(x) New KeyValuePair(Of String, String)(x.Key, x.Value)) _
    .ToList() 'A Select method to convert the items in the list properly
        'questions will appear in random order
        For Each line As KeyValuePair(Of String, String) In kvRandom
            Dim keyword As String = line.Key
            Dim correctDefinition As String = line.Value 'Checks that the correct definition will be displayed when its keyword is randomly displayed.
            'Define keywords as a new list
            Dim keywords As New List(Of String)
            keywords.Add(keyword) 'Adds the keyword to the list as the Part(0) from the text file in the first loop
            keywords.AddRange(kv.Keys.Except({keyword}).
              OrderBy(Function() r.Next).Take(NUMBER_OF_ANSWERS - 1))
            Dim definitionsRandom As List(Of String) =
              keywords.Select(Function(x) kv(x)).OrderBy(Function() r.Next).ToList 'Define definitionsRandom as a list. Checks against correctDefinition to know to always display the correct answer as one of the 
            'random definitions
            LabelKeyword.Text = keyword 'Randomly display a keyword
            RadioButtonDef1.Text = definitionsRandom(0) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
            RadioButtonDef2.Text = definitionsRandom(1) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
            RadioButtonDef3.Text = definitionsRandom(2) 'Randomly display a definition. Checks against correctDefinition to see make sure one definition is always the right answer.
        Next
    End Sub

  Private Sub radDef1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged
    Dim rad As RadioButton = sender
    'Because this event triggers when a radiobutton is
    'deselected as well as selected, we only want to process
    'the SELECTED event. Also, one radio button will be
    'selected automatically. If you start with the label
    '(which displays the word) being blank then you can
    'ignore the initial SELECTED even on form load.
    If rad.Checked And LabelKeyword.text <> "" Then
        If rad.Text = 'Not sure what to put here Then
            'the answer is correct
        Else
            'the answer is incorrect
        End If
    End If
  End Sub
End Class

Edited 2 Years Ago by Kent55

In your latest code you seem to be referencing radio buttons:
radDef1 AND RadioButtonDef1.
radDef2 AND RadioButtonDef2.
radDef3 AND RadioButtonDef3.

Do you have 6 buttons or did you forget to change this after a rename of the radio buttons?

Edited 2 Years Ago by cgeier

After you change lines 21-23 and 57-58

From:

RadioButtonDef1.Text = definitionsRandom(0)
RadioButtonDef2.Text = definitionsRandom(1)
RadioButtonDef3.Text = definitionsRandom(2)

To:

radDef1.Text = definitionsRandom(0)
radDef2.Text = definitionsRandom(1)
radDef3.Text = definitionsRandom(2)

Note: I renamed "radDef1_CheckedChanged" to "radDefx_CheckedChanged"

I added the following sub: checkAnswer

    Private Sub checkAnswer(ByRef myLabel As Label, _
                            ByRef selectedRadioButton As RadioButton)

        If Not selectedRadioButton Is Nothing Then
            If kv.ContainsKey(myLabel.Text) Then
                Console.WriteLine("contains labelkeyword.text. Value: '" & _
                                  kv.Item(myLabel.Text) & "'")
                Console.WriteLine("selectedRadioButton.text = '" & _
                                  selectedRadioButton.Text & "'")

                If String.Equals(kv.Item(myLabel.Text), _
                                 selectedRadioButton.Text) Then

                    MessageBox.Show("You are correct.")
                Else
                    'the answer is incorrect
                    MessageBox.Show("NOT correct.")
                End If
            End If
        End If
    End Sub

Then call it in "radDefx_CheckedChanged":

    Private Sub radDefx_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged
        Dim rad As RadioButton = sender

        'Because this event triggers when a radiobutton is
        'deselected as well as selected, we only want to process
        'the SELECTED event. Also, one radio button will be
        'selected automatically. If you start with the label
        '(which displays the word) being blank then you can
        'ignore the initial SELECTED even on form load.

        If rad.Checked And LabelKeyWord.Text <> "" Then

            If rad.Text <> String.Empty Then 'Not sure what to put here Then
                Console.WriteLine("in rad")

                'check to see if answer is correct
                checkAnswer(LabelKeyWord, rad)

            End If
        End If
    End Sub

Edited 2 Years Ago by cgeier

If you want to use with a "Next" button then add the following:

 Private selectedRadioButton As RadioButton

Declarations after adding:

    Private kv As Dictionary(Of String, String) 'Define kv as a dictionary
    Private keyword As String
    Private correctDefinition As String
    Const NUMBER_OF_ANSWERS As Integer = 3 'Define the constant NUMBER_OF_ANSWERS

    'Added - keeps track of which button 
    'is selected
    Private selectedRadioButton As RadioButton

Then, add the following to "radDefx_CheckedChanged":

selectedRadioButton = rad

radDefx_CheckedChanged

    Private Sub radDefx_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged
        Dim rad As RadioButton = sender

        'Because this event triggers when a radiobutton is
        'deselected as well as selected, we only want to process
        'the SELECTED event. Also, one radio button will be
        'selected automatically. If you start with the label
        '(which displays the word) being blank then you can
        'ignore the initial SELECTED even on form load.

        If rad.Checked And LabelKeyWord.Text <> "" Then

            'set so we can use with next button
            selectedRadioButton = rad

            If rad.Text <> String.Empty Then 'Not sure what to put here Then
                Console.WriteLine("in rad")


                'check to see if answer is correct
                'Not used when button is used
                'checkAnswer(LabelKeyWord, rad)

            End If
        End If
    End Sub


    Private Sub ButtonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNext.Click


        checkAnswer(LabelKeyWord, selectedRadioButton)

    End Sub

Note: Use with "checkAnswer" in my previous post.

Edited 2 Years Ago by cgeier

One more note, my code above assumes that you have 3 radio buttons on your form and the radio buttons work as a group (are on a "Panel" or "Groupbox"). Finally, that the radio buttons are named: radDef1, radDef2, radDef3.

Additionally, my previous post assumes that you have a button on your form named: ButtonNext

Edited 2 Years Ago by cgeier

O.K I didn't undestand what your code is doing, considering what you want to achieve. So I whipped up a small program to do more or less what you waanted initiallyb but there is still more work to do. Since I have not yout file I just created the list.
1) You just nedd to replace in the form load your file with my construction. I don't understand why you split the text there. I also added another textfield to the line where you can put a count in to check how often the question has been answered.
2)If you have commatas in your text use another deliminator.
3) As you will see I remove everey line from the list to avoid having to check the random numbers, I use these to retrieve text based on the index and add these later back to the list after use.
You can copy the code directly into a new project - 3 radiobuttons, 1 label ,1 button.

Imports System
Imports System.Collections.Generic
Imports System.Text
'Imports System.IO
Public Class Form1
    Dim TestMe As New List(Of String)
    Dim intCorr As Integer
    Dim str1 As String
    Dim parts1(2) As String
    Dim strBack As String = ""
    Dim strTest As String = ""
    Dim num As Integer
    Dim workStr As String = ""
    Dim clickflag As Integer = 0
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim iCount As Integer = 0
        Dim str As String = ""

        For iCount = 0 To 14
            str = "Keyword" & CStr(iCount) & "," & "Definition" & CStr(iCount) & "," & "0"
            TestMe.Add(str)
        Next
        For Each strTest In TestMe
            Debug.Print(strTest)
        Next
        fillMe()
    End Sub
    Private Sub fillMe()
        Dim RandomClass As New Random()
        Dim RandomNumber As Integer

        Dim kCount As Integer = 0

        For kCount = 0 To 1
            RandomNumber = RandomClass.Next(0, TestMe.Count)
            'Debug.Print(CStr(RandomNumber))
            workStr = Trim(TestMe(RandomNumber)) 'string to be correct
            'Debug.Print(workStr)
            Dim parts1() As String = workStr.Split(CChar(","))
            str1 = parts1(0)
            If parts1(2) = "0" Then
                num = 1
                kCount = 2
                TestMe.RemoveAt(RandomNumber)
                Label1.Text = parts1(1)
            ElseIf parts1(2) = "1" Then
                num = 2
                kCount = 2
                TestMe.RemoveAt(RandomNumber)
                Label1.Text = parts1(1)
            End If
            If parts1(2) = "2" Then
                kCount = 0
            End If
        Next

        'clear all buttons
        RadioButton1.Text = ""
        RadioButton2.Text = ""
        RadioButton3.Text = ""

        'assign the text to one radiobutton
        RandomNumber = RandomClass.Next(1, 4)
        If RandomNumber = 1 Then
            intCorr = 1
            RadioButton1.Text = str1
        ElseIf RandomNumber = 2 Then
            intCorr = 2
            RadioButton2.Text = str1
        ElseIf RandomNumber = 3 Then
            intCorr = 3
            RadioButton3.Text = str1
        End If

        'fill the other to radiobutoons with other text
        RandomNumber = RandomClass.Next(0, TestMe.Count)
        Dim strnotCorr1 As String = ""
        strnotCorr1 = Trim(TestMe(RandomNumber))
        TestMe.RemoveAt(RandomNumber)
        Dim parts2() As String = strnotCorr1.Split(CChar(","))
        If RadioButton1.Text = "" Then
            RadioButton1.Text = parts2(0)
        ElseIf RadioButton2.Text = "" Then
            RadioButton2.Text = parts2(0)
        ElseIf RadioButton3.Text = "" Then
            RadioButton3.Text = parts2(0)
        End If

        RandomNumber = RandomClass.Next(0, TestMe.Count)
        Dim strnotCorr2 As String = ""
        strnotCorr2 = Trim(TestMe(RandomNumber))
        TestMe.RemoveAt(RandomNumber)
        Dim parts3() As String = strnotCorr2.Split(CChar(","))
        If RadioButton1.Text = "" Then
            RadioButton1.Text = parts3(0)
        ElseIf RadioButton2.Text = "" Then
            RadioButton2.Text = parts3(0)
        ElseIf RadioButton3.Text = "" Then
            RadioButton3.Text = parts3(0)
        End If

        'add the two incorrect strings back to the list
        TestMe.Add(strnotCorr1)
        TestMe.Add(strnotCorr2)
    End Sub


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If clickflag = 0 Then
            MsgBox("You have not made a choice!")
        Else
            fillMe()
        End If

    End Sub
    Private Sub RadioButton1_MouseClick(sender As Object, e As MouseEventArgs) Handles RadioButton1.MouseClick

        If intCorr = 1 Then
            MsgBox("Well done")
            strBack = RadioButton1.Text & "," & Label1.Text & "," & CStr(num)
            TestMe.Add(strBack)
        Else
            MsgBox("No Good")
            TestMe.Add(workStr)
            prtlist()
            clickflag = 1
            Exit Sub
        End If
        prtlist()
        clickflag = 1
    End Sub

    Private Sub RadioButton2_MouseClick(sender As Object, e As MouseEventArgs) Handles RadioButton2.MouseClick
        If intCorr = 2 Then
            MsgBox("Well done")
            strBack = RadioButton2.Text & "," & Label1.Text & "," & CStr(num)
            TestMe.Add(strBack)
        Else
            MsgBox("No Good")
            TestMe.Add(workStr)
            prtlist()
            clickflag = 1
            Exit Sub
        End If
        prtlist()
        clickflag = 1
    End Sub

    Private Sub RadioButton3_MouseClick(sender As Object, e As MouseEventArgs) Handles RadioButton3.MouseClick
        If intCorr = 3 Then
            MsgBox("Well done")
            strBack = RadioButton3.Text & "," & Label1.Text & "," & CStr(num)
            TestMe.Add(strBack)
        Else
            MsgBox("No Good")
            TestMe.Add(workStr)
            clickflag = 1
            prtlist()
            Exit Sub
        End If
        clickflag = 1
        prtlist()
    End Sub
    Private Sub prtlist()
        For Each strTest In TestMe
            Debug.Print(strTest)
        Next
    End Sub
End Class

@kent55

I think you are making this whole thing a lot more complex than it has to be. Let's start from scratch. Let's create three class level variables

Private myDict As New Dictionary(Of String, String)
Private myDefs As New List(Of String)
Private myWrds As New List(Of String)

myDict will contain both the words (key) and the definitions (values). You will populate the dictionary at the start of the app. The other two objects will contain only the words (myWrds) and only the definitions (myDefs). You will use myWrds to pick a word at random. Once that word has been used you can remove it from myWrds thereby ensuring it will not be repeated. You will never remove entries from myDict. Likewise you will leave all the entries in myDefs (because you will want to pick random incorrect definitions for the quiz).

Note that you do not have to randomize the entries in any of the lists because you can just pick a random entry by generating a random index into the list.

You read the entries into myDict once in a loop. After reading myDict you can create the other lists by

myWrds = myDict.Keys.ToList
myDefs = myDict.Values.ToList

You pick a random word by

Dim wrd As String = myWrds(rnd.Next(0, myWrds.Count))

After you pick a word you remove it from myWrds. The next step is to create a list of three definitions, one of them being the actual definition (from myDict) and the other two being two other unique definitions (from myDefs). You should already know how to create a list and add items to it. After you add the actual definition you can use a loop like

Do Until lst.Count = 3
    Dim def As String = myDefs(rnd.Next(0, myDefs.Count))
    If Not lst.Contains(def) Then
        lst.Add(def)
    End If
Loop

I'll leave it up to you to figure out how to display the definitions from the list in random order. I already gave you a hint as to how to generate a control name reference at run time (in my code I user the names radDef1, radDef2, radDef3 for the RadioButtons).

Dim rad As RadioButton = Me.Controls("radDef" & i)

Because this portion of the code was already (mostly) posted I'll put my version here

Private Sub radDef_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged

    Dim rad As RadioButton = sender

    If Not ignore AndAlso rad.Checked Then

        If rad.Text = myDict(lblWord.Text) Then
            MsgBox("correct")
            numRight += 1
        Else
            MsgBox("incorrect")
            numWrong += 1
        End If

        If myWrds.Count > 0 Then
            NextWord()
        Else
            EndQuiz()
        End If

    End If

End Sub

I also have a few extra class level variables

Private numRight As Integer = 0
Private numWrong As Integer = 0
Private ignore As Boolean = True

The first two are obvious. The last one I use to tell the handler to ignore events when I am manually resetting the radio button check states (in the code to display the next question).

This article has been dead for over six months. Start a new discussion instead.