How to Make Something Flash in Visual Basic


Flashing things tend to catch the eye. This makes flashing an effective way to emphasize interface elements in a program. In Visual Basic 6, a programming language for Windows, most controls have a Visible property that determines whether the control is drawn on the screen. It is fairly easy to make a control appear to flash by turning its Visible property on and off.

  • Add the control that you want to make flash to your VB6 project. If you want a flashing stop sign, for example, add an Image control with a picture of a stop sign. If you want a button to flash, add the button.

  • Add a timer control to the project. The timer control is shown on your form, but will not be visible at run time.

  • Set the timer's Interval property. The interval property specifies how many milliseconds to wait between timer events. For example, if you want to make something flash off and then on every second, set the interval to 500.

  • Add code to the Timer event that toggles the control's visible property:

    Image1.Visible = Not Image1.Visible

    Because of the Not keyword, this code sets the control's Visible property to true if it is false, and to false if it is true.

  • Enable the timer to make the control start flashing:

    Timer1.Enabled = True

  • Disable the timer to make the control stop flashing:

    Timer1.Enabled = False

    Image1.Visible = False

Related Searches


  • Photo Credit Jupiterimages/Comstock/Getty Images
Promoted By Zergnet


You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!