By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Flashing Image

P: 67
Hi all

I have a chechbox and if it is unchecked i want an image to flash on and off.
I know i have to use the OnTimer but not sure how to code the check box and image together through it. Can anyone please help.

Regards

Wayne
Nov 17 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,638
  1. Assume your Check Box is named chkImage and your Image Control is named imgTest.
  2. Place an Image into the Image Control.
  3. Set the Form's Timer Interval Interval to 1000 (1 second).
  4. Copy and Paste the following code into the Timer() Event (On Timer) Property of the Form:
  5. If the Check Box is checked, the Image will flash every second. Vary the Timer Interval (1000) should you desire more or less frequent flashing.
  6. Here is goes:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Timer()
    2. Static lngCounter As Long
    3.  
    4. lngCounter = lngCounter + 1
    5.  
    6. If Me![chkImage].Value Then
    7.   If lngCounter Mod 2 = 0 Then
    8.     Me![imgTest].Visible = True
    9.   Else
    10.     Me![imgTest].Visible = False
    11.   End If
    12. Else
    13.   Me![imgTest].Visible = False
    14.  
    15. If lngCounter = 2147000000 Then lngCounter = 1
    16. End If
    17. End Sub
Nov 17 '08 #2

P: 67
Thanks ADezii

That worked great. I had similar code, just wrong way round.

Thanks
Nov 17 '08 #3

ADezii
Expert 5K+
P: 8,638
Thanks ADezii

That worked great. I had similar code, just wrong way round.

Thanks
You are quite welcome.
Nov 17 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.