I have to set the interval time,over one minute in vb6.
the point is,i set the inteval at 1 minute and write down:
timer1.interval =60000,because 1 minute is 60000,
but when i do the same thing for 2 minutes i write down timer1.inteval= 120000,and i've got the problem "Invalid property value"....how can i sort that problem out ?????
Thanks a lot to everybody...
I have to set the interval time,over one minute in vb6.
the point is,i set the inteval at 1 minute and write down:
timer1.interval =60000,because 1 minute is 60000,
but when i do the same thing for 2 minutes i write down timer1.inteval= 120000,and i've got the problem "Invalid property value"....how can i sort that problem out ?????
Thanks a lot to everybody...
The timer interval can only be set to a number between 0 and 65,536. If you need two minutes, just set it to 60,000 and wait until it triggers twice.
For example, one way would be to define a static variable in the Timer event routine, and set it to the last time the event was triggered. If the last time was less than 2 minutes ago, just Exit Sub.
I have to set the interval time,over one minute in vb6.
the point is,i set the inteval at 1 minute and write down:
timer1.interval =60000,because 1 minute is 60000,
but when i do the same thing for 2 minutes i write down timer1.inteval= 120000,and i've got the problem "Invalid property value"....how can i sort that problem out ?????
Thanks a lot to everybody...
Or Simply you can use a Flag as Integer
when the Timer reaches 60,000 then increase the flag value as
flag+=1 '.Net
flag=flag+1 'VB6
then check the Condition for flag=2...
Now, I think your problem is Solved
The timer interval can only be set to a number between 0 and 65,536. If you need two minutes, just set it to 60,000 and wait until it triggers twice.
For example, one way would be to define a static variable in the Timer event routine, and set it to the last time the event was triggered. If the last time was less than 2 minutes ago, just Exit Sub.
Could you write down the example of the code for setting the interval every two minute?Please.. .
Thanks a lot. ' [B]My version...[/B] Static LastTriggered As Date If DateDiff("s", LastTriggered, Now) < 120 Then Exit Sub End If LastTriggered = Now [B]< Insert your code here>[/B] End Sub You can easily avoid using the DateDiff function if it bothers you. ' [B]My version...[/B] Static LastTriggered As Date If DateDiff("s", LastTriggered, Now) < 120 Then Exit Sub End If LastTriggered = Now [B]< Insert your code here>[/B] End Sub You can easily avoid using the DateDiff function if it bothers you. 'If Text9.Text = "" Then MsgBox "enter a time value": End
'Timer1.Interva l = Int(Text9.Text)
'Timer1.Enabled = True
'If Text9.Text =1000 Then
'Timer1.Interva l = Int(Text9.Text)
'Timer1.Enabled = True
Endif
.....
.....
'End Sub
But I need to run it hourly. so I tried to use one of:
1. Private Sub Timer1_Timer()
4. ' hariharanmca's version...
5. Static Flag As Integer
6. Flag = Flag + 1
7. If Flag < 2 Then ‘2 minutes
8. Exit Sub
9. End If
10. Flag = 0 ' Don't forget to reset it here.
13. ' My version...
14. Static LastTriggered As Date
15. If DateDiff("s", LastTriggered, Now) < 120 Then ‘ie 2MINUTES
16. Exit Sub
16. Exit Sub
17. End If
18. LastTriggered = Now
20. Flag = 0
21. < Insert your code here>
and I still have problems.
Please help.