0

This has seriously baffled me. I have two text files one with keywords and one with definitions. What I need to do is read the textfiles into an array (or two) and assign the keyword from one with the correct definition. Then on one form the randomize the the keywords so they can't be repeated on the quiz when it loads up. The user then has to match the correct definition to the right keyword and they quiz ends when it has been completed twice. I have tried to read the file into the array but I haven't succeeded, not to mention how to then randomize the array so that it is different every time the quiz is loaded.

2
Contributors
1
Reply
14
Views
3 Years
Discussion Span
Last Post by Reverend Jim
1

You can create a dictionary to hold the keywords and definitions.

Dim Words As New Dictionary(Of String, String)

The key is the word and the value is the definition. Then create a list from just the words. To randomize the list in the display you can

do while the list isn't empty
    generate a random number from 0 to list.Count - 1
    copy that list element to the display
    delete that list element
loop

Edited by Reverend Jim

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.