Making a button or label flashing
Sometime it is nice to have a label or button flashing to remind the user. It is an extra decoration for your program to make it looks professional. You can click on button to make a flashing button to stop or you can set a certain time to make it stop flashing. The steps below will show you how to make a button flashing.
Step #1 Create a form and place a button on form. Name a caption of button as Add New and leave a button name as Command0
Step #2 Double click on the form property on top left hand corner to open the Form Property Sheet. Select Event Procedure under the Form On Load event. Enter Me.TimerInterval = 300 milliseconds as shown below:
Private Sub Form_Load()
Me.TimerInterval = 300
End Sub
Step #3 Select Event Procedure under the Timer Event. Place code below under the Form Timer() procedure. For this example, I use .BackColor to make a background color flashing with green and yellow.
Private Sub Form_Timer() With Me.Command0 .BackColor = (IIf(.BackColor = vbGreen, vbYellow, vbGreen)) End With End Sub
Step #4 To make a button flashing stop, I will put Me.TimerInterval =0 under the On Click Event Procedure of the Add New button.
Private Sub Command0_Click()
Me.TimerInterval = 0
End Sub
Step #5 If I want the background color of Add New button to change color to white then I will add code as:
Private Sub Command0_Click()
While it is normal for most of us talk about the metabolic process as a single function, it's actually a conglomeration of functions that are normally performed by the body. sildenafil free shipping Sildenafil citrate Tablets are known canadian viagra sales to every man, who, for whatever reasons, reduced erectile function. Doctors do not treat the body as whole and viagra soft 50mg how to correct imbalances and injuries naturally using manipulative therapies and other natural modalities. Stress should be taken care of as and when you feel; that it is building up in your life. pfizer viagra Me.TimerInterval = 0
Me.Command0.BackColor = vbWhite
End Sub
Step #6 If I want to make a font color flashing Red Yellow Red Yellow…. I will use .ForeColor with Me.Command0 as shown in the picture below:
Private Sub Form_Timer() With Me.Command0 .ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed)) End With End Sub
Step# 7 If I want to it stop flashing automatically at a certain set time. I need to set a counter for the flashing button. For this example, I want the button stop flashing after it is blinking for 30 times by using the code below under the Form Timer Event. I don’t have to click on the button to make it stop. It will stop flashing after 30 times of flashing.
Private Sub Form_Timer()
With AddNew
.BackColor = (IIf(.BackColor = vbGreen, vbYellow, vbGreen))
Static iCount As Integer
iCount = iCount + 1
If iCount = 30 Then
Me.TimerInterval = 0
Me. Command0.BackColor = vbWhite
Exit Sub
End If
End With
End Sub