I\'m having some trouble with this Visual Basic question. I need to change th Do
ID: 3590952 • Letter: I
Question
I'm having some trouble with this Visual Basic question.
I need to change th Do...Loop statement in the btnClickHere_Click procedure to a For...Next statement. Here's the code for the Do...Loop
Private Sub btnClickHere_Click(sender As Object, e As EventArgs) Handles btnClickHere.Click
' blinks the message in the lblMsg control
' declare counter
Dim intCount As Integer
' begin counting
intCount = 1
Do
If lblMsg.Visible = False Then
lblMsg.Visible = True
Else
lblMsg.Visible = False
End If
Me.Refresh()
System.Threading.Thread.Sleep(250)
' update the counter
intCount = intCount + 1
Loop Until intCount > 20
End Sub
End Class
Explanation / Answer
Private Sub btnClickHere_Click(sender As Object, e As EventArgs) Handles btnClickHere.Click
' blinks the message in the lblMsg control
' declare counter
Dim intCount As Integer
' begin counting
intCount = 1
For intCount = 1 To 20
If lblMsg.Visible = False Then
lblMsg.Visible = True
Else
lblMsg.Visible = False
End If
Me.Refresh()
System.Threading.Thread.Sleep (250)
' update the counter
intCount = intCount + 1
Next
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.