How can I start blinking certain label and stop it ?

  • Thread starter Thread starter anj
  • Start date Start date
A

anj

Dear All

Thanks in advance!

I want to start a label to blink after updating value on a
certain control and stop it after clicking a command
button. How can I do it by writing code?
And how can I undo changes to value on a control after
entering new value back to its original value?
 
Be careful with the blinking. If you over do it, you'll drive the users
nuts. That said, to make a label blink, use the form's Timer event. In that
event, make the label alternately visible/not visible.

Example:
Me.LabelName.Visible = Not Me.LabelName.Visible

To start and stop this, set the form's Timer Interval property in your code.
Setting the Timer Interval to 0 will stop the flashing, setting it to any
other positive integer will start the flashing at the rate you set. The
value is for 1/1000 seconds, so to flash once per second you would enter a
value of 1000. When you set the Timer Interval back to 0, be aware that the
control may be in either cycle of the flash (visible/not visible) so you'll
also need to set the Visible property of the label in the code that sets the
timer interval to 0.

Example:
Me.TimerInterval = 1000

If you know that you only want the label to flash a certain number of times,
say 10, then you could have the timer event stop itself by using a static
variable in the timer event.

Example:
Static intCounter As Integer
intCounter = intCounter + 1
Me.LabelName.Visible = Not Me.LabelName.Visible
If intCounter >= 10 Then
Me.TimerInterval = 0
Me.LabelName.Visible = True
intCounter = 0
End If


To change the value of a control back to its old value, just Undo the
control.

Example:
Me.ControlName.Undo

If the control has updated (it's no longer the active control) but the
record hasn't yet been saved, then you can use the OldValue property of the
control.

Me.ControlName = Me.ControlName.OldValue
 
Check out Timer Interval, Timer Event, and On Timer in Help. It explains,
and shows examples on using timer functions.
In "aircode"...
When your form event occurs...
Establish a Timer Interval (TimerInterval = 500) for .5 seconds
In the EventProcedure behind the OnTimer event (using Boolean True
false logic....)
If ON = True then hi-lite the caption and set ON = False
Else don't hi-lite the caption and On = True
When the button is clicked, stop the Timer (TimerInterval=0)

Once the timer starts, each pass through the code will alternate the
hi-lite On Off.
Al Camp
 
Back
Top