Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer parameters

Status
Not open for further replies.

WynneSMI

Programmer
Dec 16, 2002
76
US
I have a very simple VB6 app that has a timer control on it. What I want to know is there a way to pass in parameters to a timer. If I set my variables in the timer, then they get overwritten. I tried putting them in the FormLoad but I can figure out a way to pass them into the timer. If I try to set the timer sub to take parameters I get a compiler error: Procedure declaration does not match description of event or procedure having the same name. Is there a way to pass variables into a timer function without the variables being overwritten? Thanks.
 

From another post here is an example of modifying the value of a variable in a timer.
[tt]
Option Explicit

Dim MaxHasBeenReached As Boolean

Private Sub Form_Load()
Timer1.Interval = 10
End Sub

Private Sub Timer1_Timer()

If MaxHasBeenReached = True Then
Label1.Left = Label1.Left - 10
If Label1.Left <= 0 Then MaxHasBeenReached = False
Else
Label1.Left = Label1.Left + 10
If (Label1.Left + Label1.Width) >= Me.Width Then MaxHasBeenReached = True
End If

End Sub
[/tt]

is this something like you are asking?

or are you talking about using the Static keyword?

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top