I have a need to be able to change the me.BackColor = System.Drawing.Color.FromName(“@invalid”)
Then, after 2 seconds, flip it to another color
me.BackColor = System.Drawing.Color.FromName(“@window”)
Depending on what is happening, the color could be @focusFrame or @highlight also.
If I change the color and then use a timer to change it after 2 seconds I get inconsistent results. Sometime the color does change and sometimes it does not.
What is the correct method to be able to change colors in the form (say when a button is pressed), and then change it again 2 seconds later (presumably in a timer).
It’s possible that the timer fires when the color has been changed again and is not in sync. Remember that you can change the color several times but the code is running on the server and the client is update only after all the events have been processed. If you press the button and timer fires very close to the pressing then the color changes twice and you see only the result in the client.
If I understood the requirement, keep the timer disabled, when the button is pressed change the color and start (stop and start to make sure it starts from 0) the times (so you know the 2 seconds start more or less from there). When the time ticks, change the color and stop the timer.
Please login first to submit.