Hi,
I have two string lists in VB.NET 2010, one with questions and one with answers:
I have got code to randomly pick a entry from the list and display it in a textbox:Code:questionlist.Add("When shall we meet?") questionlist.Add("Let's meet at eight") questionlist.Add("Shall we meet in front of the bar?") questionlist.Add("Where are you going to go at the weekend?") questionlist.Add("Who are you going to go with?") questionlist.Add("Where shall we meet?") questionlist.Add("I'm going to go to Granada with my friend") questionlist.Add("When are you going to leave?") questionlist.Add("I'm going to leave on Saturday at eight") questionlist.Add("How long are you going to stay?") questionlist.Add("I'm going to stay two nights") questionlist.Add("What are you going to do?") questionlist.Add("I'm going to visit some typical villages") answerlist.Add("A que hora nos vemos?") answerlist.Add("Nos vemos a las ocho") answerlist.Add("Nos vemos delante del bar?") answerlist.Add("Adonde vas a ir el fin de semana?") answerlist.Add("Con quien vas a ir?") answerlist.Add("Donde nos vemos?") answerlist.Add("Voy a ir a Grandada con mi amiga") answerlist.Add("Cuando vas a salir?") answerlist.Add("Voy a salir el sabado a las ocho") answerlist.Add("Cuanto tiempo vas a quedarte") answerlist.Add("Voy a quedarme dos noches") answerlist.Add("Que vas a hacer?") answerlist.Add("Voy a visitar pueblos tipicos")
There is then another box to enter the answer to the question. When a button is clicked the program will check if the answer matches the answer in the list.Code:TextBox2.Text = questionlist.Item(Int(Rnd() * (questionlist.Count - 1))) TextBox3.Text = questionlist.Item(Int(Rnd() * (questionlist.Count - 1))) TextBox5.Text = questionlist.Item(Int(Rnd() * (questionlist.Count - 1))) TextBox7.Text = questionlist.Item(Int(Rnd() * (questionlist.Count - 1))) TextBox9.Text = questionlist.Item(Int(Rnd() * (questionlist.Count - 1)))
The problem is that I need it to pick the corresponding entry from the answer list to check if the answer is correct. How can I do this?




Reply With Quote
