Blinking button

T

tony wong

i wish to make the button blinking for 5 times at 1 second interval.

how come i cannot see the blinking effect?

is there any screen update function? Thanks.

******************************
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Button1.BackColor = Color.Red Then
Dim a
For a = 1 To 5
Button1.BackColor = Color.Yellow
System.Threading.Thread.Sleep(1000)
Button1.BackColor = Color.Red
Next
Else
Button1.BackColor = Color.Red
End If
End Sub
 
T

The Grim Reaper

Add

Application.DoEvents()

after your sleep line.
__________________________________________
The Grim Reaper
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top