By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Blinking button

P: n/a
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
Nov 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Add

Application.DoEvents()

after your sleep line.
__________________________________________
The Grim Reaper

"tony wong" <x3*@netvigator.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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


Nov 18 '06 #2

P: n/a
Thanks a lot.
"The Grim Reaper" <gr*********@REMOVEbtopenworld.comglsD:x J********************@bt.com...
Add

Application.DoEvents()

after your sleep line.
__________________________________________
The Grim Reaper

"tony wong" <x3*@netvigator.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>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



Nov 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.