Solved

Make label flash with different Background colors

Posted on 2000-05-12
4
1,293 Views
Last Modified: 2008-02-01
How is it possible to make a label background color change from one color to another creating a flashing effect on a form ? Do you use the form timer event, loop functions or what...

Thank you
0
Comment
Question by:fouchev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
mcmonniesa earned 50 total points
ID: 2806169
Start by setting the label's "Back Style" to "Normal".  Next set the form's timer interval to a value (i.e., 1000 = 1 second, 100 = 1/10th of a second).  Then add code to the Form_Timer event like:

Private Sub Form_Timer()

   If lblFlasher.BackColor = vbRed Then
      lblFlasher.BackColor = vbBlue
   Else
      lblFlasher.BackColor = vbRed
   End If
   
End Sub

This sample should flash red and blue.  You can expand it to more colors or use an array of colors.
0
 
LVL 1

Expert Comment

by:mcmonniesa
ID: 2806174
Additionally the Form_Timer event acts like a continuous loop.  That is every time the interval hits (times out) the code is run.  To stop the timer, close the form or set it off in code:

    Me.TimerInterval = 0

0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2806177
Option Explicit

Dim FlashState As Boolean

Private Sub Form_Timer()

       FlashState = Not FlashState

       If FlashState = True Then
              Me!ctrl.BackColor = 255      ' Red
       Else
              Me!ctrl.BackColor = 65535  ' Yellow
       End If

End Sub  

Then set the Timer interval to what you like.

To trun off the flashing, set Timer interval = 0

Brian
0
 
LVL 4

Expert Comment

by:mberumen
ID: 2806186
you could also expand fouchev's code to occur whenever a condition is meet in your database... such as an error or update..

function sub flashlabel()
for counter=1 to 100 step 10

                         If lblFlasher.BackColor = vbRed Then
                            lblFlasher.BackColor = vbBlue
                         Else
                            lblFlasher.BackColor = vbRed
                         End If
next
                         
End Sub

'then  you could call the function as needed
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question