Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        While NextFrame <= numericUpDown1.Value
            Controls("Label" & NextFrame.ToString()).BackColor = Color.Yellow
            Sleep(2000)
            handler.Send(Encoding.ASCII.GetBytes(NextFrame.ToString()))
            NextFrame = NextFrame + 1
        End While
    End Sub


color.yellow is working before sleep(2000) but we can't visualize that yellow color. What is the solution to get yellow color as output?
Posted

1 solution

Try adding a Refresh() method to your control before entering the sleep().
The problem is that during sleep the whole thread is frozen even the message loop and controls dispatching don't works.
Maybe you wan use a different method to wait (i.e. using a timer).
You may want have a look to this discussion thread.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900