I need some help. I have been problems getting my programs to recognize variables outside of the subroutines even if I make them public. Ive been able to work around the problem until now. I am working with arrays. It wont let me declare the array outside the subroutine and it says the array is not declared. If i put it in the first subroutine the second subroutine doesnt recognize the first array. Can anyone help me?
Public Class Form1
Public Sub getbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getbtn.Click
Dim q(5) As String
q(0) = "Declare xyz as an integer"
q(1) = "Declare bottom as a string"
q(2) = "What property needs to be adjusted to affect the order users tab to controls in"
q(3) = "Declare number as a random object"
q(4) = "Declare Doppleganger as a double"
Dim r As New Random()
Dim nextquestion As Integer
nextquestion = r.Next(0, 5)
answtxt.Text = q(nextquestion)
End Sub
Private Sub enterbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles enterbtn.Click
Dim a(5) As String
a(0) = "Dim xyz As Integer"
a(1) = "Dim bottom As String"
a(2) = "TabIndex"
a(3) = "Dim number As New Random()"
a(4) = "Dim doppleganger As Double"
Dim question As String
Dim ans, rightanswer As String
question = answtxt.Text
ans = questtxt.Text
If question = q(o) Then
rightanswer = a(0)
ElseIf question = q(1) Then
rightanswer = a(1)
ElseIf question = q(2) Then
rightanswer = a(2)
ElseIf question = q(3) Then
rightanswer = a(3)
ElseIf question = q(4) Then
rightanswer = a(4)
End If
If ans = rightanswer Then
MsgBox("Fantastic!")
Else
MsgBox("Wrong, form should be as in this example: Dim x As Integer")
answtxt.Focus()
End If
End Sub
End Class