Loop wont display text in a form label
I am having trouble changing the text in a label. Can someone show me where the problem is?
Public Class Form1
Dim Tracker As Integer = 0
Dim Questions(10) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Questions(0) = "Are you mad?"
Questions(1) = "Are you sad?"
Questions(2) = "Are you glad?"
Questions(3) = "Are you happy?"
Questions(4) = "Are you indebted?"
Questions(5) = "Are you swimming in money?"
Questions(6) = "Do you play sports?"
Questions(7) = "Do you watch SportsCenter?"
Questions(8) = "Do you cheer for the Pistons?"
Questions(9) = "Do you cheer for the Lions?"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Button1.Text = "Next"
For i = 0 To Questions.Length - 1
Label1.Text += Questions(i)
Next
开发者_JAVA百科
End Sub
End Class
I just used the button click to increment a counter variable, and then set that variable to the array index.
精彩评论