DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Toggle Text On Button (Using Thread Timers)

10.19.2007
| 3915 views |
  • submit to reddit
        // Works on a seperate thread and changes the color of a button if a significant event happens

void HotShotTick(object obj)
{
if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate {
this.FillHotshots();
if (this.dsSignificant.HotshotBets.Rows.Count > 0)
{
this.btnHotShotBets.BackColor = Color.Red;
}
else
{
this.btnHotShotBets.BackColor = Color.Green;
}
});
}