Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Interval Property Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' The example allows you to adjust the speed at which a form switches colors
' by dragging the scrollbox along the horizontal scroll bar.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form with:
' • Timer
' • Picture box
' • Horizontal scroll bar
' 3. Set properties:
' • For timer, Interval = 900
' • For picture box, BackColor = 1 (Blue)
' • For scroll bar, Max = 900, Min = 100
' 4. Press Alt+F4 to return to the programming environment
' 5. Copy the code example below to the form module
' 6. Press F5 to run the example
SUB HScroll1_Change () ' Set interval according to scroll bar value
Timer1.Interval = 1000 - HScroll1.Value
END SUB
SUB Timer1_Timer () ' Switch BackColor between Red and Blue
IF Picture1.BackColor = 1 THEN
Picture1.BackColor = 4
ELSE
Picture1.BackColor = 1
END IF
END SUB