Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote