kvarnerexpress 0 Report post Posted January 18, 2005 I'm usually very well a creating a problems and then finding a solution. However this time I'm stumped.I'm attempting to create timers.. I know this is possible by doing... visual basic code:--------------------------------------------------------------------------------Option ExplictDim WithEvents tmrTimer1 As VB.TimerPrivate Sub Form1_OnLoad()Set tmrTimer1 = Me.Controls.Add("VB.Timer", "Timer1")End Sub--------------------------------------------------------------------------------Now, what I need is to be able to create those timers, but creating them so they belong to an array of timers.Any ideas, hints, suggestions...???__________________' Comments go here... Share this post Link to post Share on other sites
whyme 0 Report post Posted January 31, 2005 Heh heh, You've come to the right guy. I've madea little 10 mintue timer scirpt with VB, and after 10 mins, it auto resets it self. Here's the code. Option ExplicitPrivate Sub Form_Load()Timer1.Interval = 1000Label1.Caption = "601"End SubPrivate Sub Timer1_Timer()If Label1.Caption = 0 ThenTimer1.Enabled = FalseMsgBox "10 minutes is up! - REMEMBER THE 10-10-10 RULE." & Chr$(10) & "Look at something 10 feet away for 10 seconds." & Chr$(10) & "Click OK to restart the timer."Timer1.Interval = 1000Label1.Caption = "601"Timer1.Enabled = TrueLabel1.RefreshElseLabel1.Caption = Label1.Caption - 1End IfEnd Sub I'm not sure about the arrays, but here is how it should work. You need to drop in a label, and a timer function for it to work. Share this post Link to post Share on other sites
Galahad 0 Report post Posted February 5, 2005 Just drop a Timer on a form, and set it's index to 0... then Load new timers, like this For i=1 to 10 Load Timer(i) Timer(i).interval = 100 Timer(i).enabled = trueNext iAnd you would have something like thisPrivate Sub Timer(Index As Integer)Select Case IndexCase 0' code to execute for Timer(0)Case 1' code to execute for Timer(1)Case Else' other codeEnd SubI wrote it from the head, didn't try it, but I think it should work... Share this post Link to post Share on other sites