Home All Groups Group Topic Archive Search About
Author
18 Nov 2006 2:08 PM
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

Author
18 Nov 2006 2:53 PM
The Grim Reaper
Add

    Application.DoEvents()

after your sleep line.
__________________________________________
The Grim Reaper

Show quoteHide quote
"tony wong" <x**@netvigator.com> wrote in message
news:%23CrPIsxCHHA.4404@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
>
>
Author
18 Nov 2006 3:06 PM
tony wong
Thanks a lot.


Show quoteHide quote
"The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> ¼¶¼g©ó¶l¥ó·s»D:xJidnbEzq6Xog8LYRVn***@bt.com...
> Add
>
>    Application.DoEvents()
>
> after your sleep line.
> __________________________________________
> The Grim Reaper
>
> "tony wong" <x**@netvigator.com> wrote in message
> news:%23CrPIsxCHHA.4404@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
>>
>>
>
>