troubleshooting Question

flashing textbox background color

Avatar of tentavarious
tentavarious asked on
Visual Basic.NET
1 Comment1 Solution1975 ViewsLast Modified:
Hello experts, i am trying to change the background color of a textbox control in my vb.net win app when the value in my textbox is less then 0.  I tried using timers and threads but nothing seems to work.  Basically I have a textfield that counts down when it goes past 0 i want it to flash red then back to its orginal color every second until the textfield is greater then or equal to 0.  Here is what i tried.

 Private Sub txtcount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcount.TextChanged
      if val(txtcount.text) < 0
    timer3.start()
      else
   timer3.stop()
     end if
    End Sub

 Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
 txtcount.background  = color.red
 system.threading.thread.sleep(500) 'pauses the red flash
 txtcount.background = color.lightsteelblue 'Orginal color of textbox      
 End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros