in the normal state the background(graphical mode) would be white, in operation mode the background would flash between red & white.

You could use a timer like this:
Timer1_Timer()

If Command1.BackColor = vbWhite Then
Command1.BackColor = vbRed

ElseIf Command1.BackColor = vbRed Then
Command1.BackColor = vbWhite
End If

end if

_________________________________________________________________

thanks mike, didn't notice that...

corrected:

Timer1_Timer()

If Command1.BackColor = vbWhite Then
Command1.BackColor = vbRed

Else

Command1.BackColor = vbWhite
End If

end if

MikeJ

02-10-2005, 09:32 PM

What have you tried? Put a timer on your form, and in the Timer() event, check what the BackColor is. If it's vbRed then change it to vbWhite, and if it's vbWhite, change it to vbRed.

NEOLLE:
Don't use IIf - it will always evaluate both arguments, something that will add a little bit of time to the run time. It'd be insignificant in this case, but you might want to get into the habit of not doing it.

Verphix:
Yours evaluates both each time as well. You just need a simple Else because those would be the only two options. Your version is just an expanded form of IIf. :)

CostaM

02-10-2005, 09:47 PM

In it's simplest form it would look like this

You make a new timer TIMER1 and that will control whether the button is flashing, aswell as controlling the flashing.

If the timer is not enabled, (TIMER1 = FALSE) then it is not flashing

when timer1 is enabled it should execute this code in the timer event:

in the normal state the background(graphical mode) would be white, in operation mode the background would flash between red & white.

RonR

02-10-2005, 09:55 PM

thanks for the options, i will try them.

thanks!!!!

passel

02-11-2005, 12:23 AM

I prefer declaring a constant with the two colors I want to flash between.
Then preset the command button to one of the colors, i.e. vbWhite.
Then just toggle it in the Timer with no need for waste of an If, Else condition.

Const FlashRedWhite As Long = vbRed Xor vbWhite
'Remember to set the Command Button's background to Red or White, or you'll flash
'between two different colors, not Red and White, or worse, get an error trying to toggle
'a system color.