i am working on a game in vb.net which is designed to ask the user a set of questions which are stored in multidimensional arrays. the user can answer the questions by clicking one of four buttons.
I currently have a set of buttons numbered 1-4, I also have a set of arrays but I am stuck making the game move on to the next set of questions.
the question is put in a text box and the answers are put in the four buttons, I need to be able to set the program to check if the button pressed if correct and if so move onto the next question.
heres my code so far
Public Class Form1
Dim intQuestionNo As Integer
Dim strQuestionInfo(15, 4) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
intQuestionNo = 0
txtQuestionNo.Text = intQuestionNo
If intQuestionNo = 2 Then
question2()
End If
strQuestionInfo(0, 0) = "how many colours on the UK flag?"
strQuestionInfo(0, 1) = "1"
strQuestionInfo(0, 2) = "3"
strQuestionInfo(0, 3) = "5"
strQuestionInfo(0, 4) = "7"
strQuestionInfo(1, 0) = "which of these famous uk landmarks can be found in london?"
strQuestionInfo(1, 1) = "Big Ben"
strQuestionInfo(1, 2) = "Stonehenge"
strQuestionInfo(1, 3) = "Hadrians Wall"
strQuestionInfo(1, 4) = "The While Cliffs of Dover"
strQuestionInfo(2, 0) = "What is the chemical composition of water?"
strQuestionInfo(2, 1) = "H2"
strQuestionInfo(2, 2) = "20"
strQuestionInfo(2, 3) = "H20"
strQuestionInfo(2, 4) = "02H"
strQuestionInfo(3, 0) = "what is the largest state in the United states of America?"
strQuestionInfo(3, 0) = "New York"
strQuestionInfo(3, 0) = "Texas"
strQuestionInfo(3, 0) = "Alabama"
strQuestionInfo(3, 0) = "Alaska"
strQuestionInfo(4, 0) = "What year did world war 2 end?"
strQuestionInfo(4, 0) = "1944"
strQuestionInfo(4, 0) = "1946"
strQuestionInfo(4, 0) = "1948"
strQuestionInfo(4, 0) = "1952"
End Sub
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
btnStart.Hide()
intQuestionNo += 1
If intQuestionNo = 1 Then
question1()
End If
End Sub
Sub question1()
txtQuestion.Text = strQuestionInfo(0, 0)
btnAnswer1.Text = strQuestionInfo(0, 1)
btnAnswer2.Text = strQuestionInfo(0, 2)
btnAnswer3.Text = strQuestionInfo(0, 3)
btnAnswer4.Text = strQuestionInfo(0, 4)
End Sub
Sub question2()
txtQuestion.Text = strQuestionInfo(1, 0)
btnAnswer1.Text = strQuestionInfo(1, 1)
btnAnswer2.Text = strQuestionInfo(1, 2)
btnAnswer3.Text = strQuestionInfo(1, 3)
btnAnswer4.Text = strQuestionInfo(1, 4)
End Sub
Sub question3()
txtQuestion.Text = strQuestionInfo(2, 0)
btnAnswer1.Text = strQuestionInfo(2, 1)
btnAnswer2.Text = strQuestionInfo(2, 2)
btnAnswer3.Text = strQuestionInfo(2, 3)
btnAnswer4.Text = strQuestionInfo(2, 4)
End Sub
Sub question4()
txtQuestion.Text = strQuestionInfo(3, 0)
btnAnswer1.Text = strQuestionInfo(3, 1)
btnAnswer2.Text = strQuestionInfo(3, 2)
btnAnswer3.Text = strQuestionInfo(3, 3)
btnAnswer4.Text = strQuestionInfo(3, 4)
End Sub
Sub question5()
txtQuestion.Text = strQuestionInfo(4, 0)
btnAnswer1.Text = strQuestionInfo(4, 1)
btnAnswer2.Text = strQuestionInfo(4, 2)
btnAnswer3.Text = strQuestionInfo(4, 3)
btnAnswer4.Text = strQuestionInfo(4, 4)
end sub
Private Sub btnAnswer1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswer1.Click
End Sub
End Class