title: Quiz Program at Visual Basic
body: <p>Sorry for the disturbance but can you help me in my problem?</p>
  
  <p>I'm new at visual basic programming and everything was fine until our topic shifted to arrays. I tried to understand it's code using Java. (Example: method are called functions.. .)</p>
  
  <p>My prof has given us an exercise to create a Quiz program that asks the user more than 5 questions (in textbox) with choices (in buttons) and computes the score at the end (All just in one form). If the user click an a button it will tell if it's right or wrong and then proceed to change the question along with the choices.</p>
  
  <p>*Required:
  - After the user finish the quiz the score will be displayed and there should be a restart button and all the question will be asked again randomly no pattern.
  - Try to make functions.</p>
  
  <p>I tried searching the web since yesterday and I still have made no progress at my code.</p>
  
  <pre><code>    Public Class Form1
  Dim questions(5) As String
  Dim answers(5) As String
  
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'Method/Function for loading the Q&amp;A
      loadQsAndAs()
  End Sub
  
  Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
      Me.Close()
  End Sub
  
  Private Sub loadQsAndAs()
      'Questions
      questions(0) = "What is 1 + 1?"
      questions(1) = "Who is the first man to walk on the Moon?"
      questions(2) = "What is the name of the main character in the movie: Yes Man!(2007)"
      questions(3) = "If I gave you three apples and you ate two, how many is left?"
      questions(4) = "What do you want in your final grade?"
      questions(5) = "What is the name of the thing(s) that you use whenever you eat?"
      'Answers
      answers(0) = "2"
      answers(1) = "Neil Armstrong"
      answers(2) = "Jim Carrey"
      answers(3) = "1"
      answers(4) = "A 4.0"
      answers(5) = "A Spoon and Fork"
  
      TextBox1.Text = setTheQuestion()
      Button1.Text = setTheAnswer1()
      Button2.Text = setTheAnswer2()
      Button3.Text = setTheAnswer3()
      Button4.Text = setTheAnswer4()
  
  End Sub
  
  Private Function setTheQuestion() As String
      Dim randomValue As New Random
      Dim randomQ As String = ""
      Dim i As Integer
      Dim index As Integer
  
      For i = 0 To 0
          index = randomValue.Next(0, questions.Length)
          randomQ &amp;= questions(index)
      Next
      Return randomQ
  End Function
  
  Private Function setTheAnswer1() As String
      Dim randomValue As New Random
      Dim randomAns As String = ""
      Dim i As Integer
      Dim index As Integer
  
      For i = 0 To 0
          index = randomValue.Next(0, answers.Length)
          randomAns &amp;= answers(index)
      Next
  
      Return randomAns
  End Function
  
  Private Function setTheAnswer2() As String
      Dim randomValue As New Random
      Dim randomAns As String = ""
      Dim i As Integer
      Dim index As Integer
  
      For i = 0 To 0
          index = randomValue.Next(1, answers.Length)
          randomAns &amp;= answers(index)
      Next
  
      Return randomAns
  End Function
  
  Private Function setTheAnswer3() As String
      Dim randomValue As New Random
      Dim randomAns As String = ""
      Dim i As Integer
      Dim index As Integer
  
      For i = 0 To 0
          index = randomValue.Next(2, answers.Length)
          randomAns &amp;= answers(index)
      Next
  
      Return randomAns
  End Function
  
  Private Function setTheAnswer4() As String
      Dim randomValue As New Random
      Dim randomAns As String = ""
      Dim i As Integer
      Dim index As Integer
  
      For i = 0 To 0
          index = randomValue.Next(3, answers.Length)
          randomAns &amp;= answers(index)
      Next
  
      Return randomAns
  End Function
  
  Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
      loadQsAndAs()
  End Sub
      End Class
  </code></pre>
  
  <p>My questions are:</p>
  
  <ul>
  <li><p>How do I make the questions and my choices in an array to appear randomly whenever the user starts or restarts the program?</p></li>
  <li><p>How do I code that the random question will also have the correct answer with the other 3 random answers? (Because mine is just randomizing the answer and it keeps repeating some choices)</p></li>
  </ul>
  
  <p>Can anyone help me?</p>