Home All Groups Group Topic Archive Search About

Timer driving me nuts

Author
28 Aug 2006 3:32 PM
John
Hi

I have a timer on my form. The problem is no matter how large an interval I
set, the timer_tick event always gets called very fast. What am I doing
wrong?

Thanks

Regards

Author
28 Aug 2006 4:02 PM
IdleBrain
Hey John,
R u setting the timer interval at runtime after starting the timer?
If that is the case, set the timer interval before starting the timer.

Hope it helps.


John wrote:
Show quoteHide quote
> Hi
>
> I have a timer on my form. The problem is no matter how large an interval I
> set, the timer_tick event always gets called very fast. What am I doing
> wrong?
>
> Thanks
>
> Regards
Author
28 Aug 2006 4:09 PM
John
I have set it at design time and it currently stands at 600000. Still too
fast almost like 1 second. I am running my process in the Timer_Tick event.

Thanks

Regards

Show quoteHide quote
"IdleBrain" <indianmostwan***@yahoo.com> wrote in message
news:1156780957.716168.272910@i3g2000cwc.googlegroups.com...
>
> Hey John,
> R u setting the timer interval at runtime after starting the timer?
> If that is the case, set the timer interval before starting the timer.
>
> Hope it helps.
>
>
> John wrote:
>> Hi
>>
>> I have a timer on my form. The problem is no matter how large an interval
>> I
>> set, the timer_tick event always gets called very fast. What am I doing
>> wrong?
>>
>> Thanks
>>
>> Regards
>
Author
28 Aug 2006 9:40 PM
GhostInAK
Hello John,

If I remember correctly the Timer.Interval will accept a large numer, like
600000, however the only valid numbers are 0 through ~32000.  Interval is
defined in milliseconds.

-Boo

Show quoteHide quote
> I have set it at design time and it currently stands at 600000. Still
> too fast almost like 1 second. I am running my process in the
> Timer_Tick event.
>
> Thanks
>
> Regards
>
> "IdleBrain" <indianmostwan***@yahoo.com> wrote in message
> news:1156780957.716168.272910@i3g2000cwc.googlegroups.com...
>
>> Hey John,
>> R u setting the timer interval at runtime after starting the timer?
>> If that is the case, set the timer interval before starting the
>> timer.
>> Hope it helps.
>>
>> John wrote:
>>
>>> Hi
>>>
>>> I have a timer on my form. The problem is no matter how large an
>>> interval
>>> I
>>> set, the timer_tick event always gets called very fast. What am I
>>> doing
>>> wrong?
>>> Thanks
>>>
>>> Regards
>>>
Author
29 Aug 2006 11:24 AM
Stuart Nathan
Can we see the code?
Author
29 Aug 2006 2:02 PM
John
Got it now thanks. My only problem now is to set the interval to about 5
minutes. If the highest interval the timer can take is 32000 (32 seconds?)
then how does one get round it?

Thanks again everyone.

Regards

Show quoteHide quote
"Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
> Can we see the code?
>
Author
29 Aug 2006 2:21 PM
JR
from the help:
    The interval can be between 1 and 64,767, inclusive, which means that
even the longest interval will not be much longer than one minute (about
64.8 seconds).

now if you need a larger timer try the following.

Add a static variable.

rease the variable each time you enter the sub. When you have the seconds
you need (if - end if) do your stuff

Jan


Show quoteHide quote
"John" <John@nospam.infovis.co.uk> schreef in bericht
news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
> Got it now thanks. My only problem now is to set the interval to about 5
> minutes. If the highest interval the timer can take is 32000 (32 seconds?)
> then how does one get round it?
>
> Thanks again everyone.
>
> Regards
>
> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>> Can we see the code?
>>
>
>
Author
29 Aug 2006 2:49 PM
Claes Bergefall
I've never heard of a 32/64/whatever sec limitation (except on Windows 3.x).
Both of the following works fine on my machine:

Timer1.Interval = 60000 '1 minute interval
Timer1.Start()

Timer1.Interval = 300000 '5 minute interval
Timer1.Start()


According to the docs for SetTimer (that System.Windows.Forms.Timer uses)
the maximum value for the interval is USER_TIMER_MAXIMUM. That constant is
defined in winuser.h as 0x7FFFFFFF

There must be something else that's wrong in this case. Show your code

    /claes

Show quoteHide quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
> Got it now thanks. My only problem now is to set the interval to about 5
> minutes. If the highest interval the timer can take is 32000 (32 seconds?)
> then how does one get round it?
>
> Thanks again everyone.
>
> Regards
>
> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>> Can we see the code?
>>
>
>
Author
29 Aug 2006 8:11 PM
Theo Verweij
I think there is a misunderstanding between the readers.
There are 2 types of timers available:
1. The timer control (System.Windows.Forms.Timer)
2. The timer class (System.Timers.Timer)

The first one is a control, and has a limititation of 64,767 seconds.
The second one is a class, and does not have this limitation.


Claes Bergefall wrote:
Show quoteHide quote
> I've never heard of a 32/64/whatever sec limitation (except on Windows 3.x).
> Both of the following works fine on my machine:
>
> Timer1.Interval = 60000 '1 minute interval
> Timer1.Start()
>
> Timer1.Interval = 300000 '5 minute interval
> Timer1.Start()
>
>
> According to the docs for SetTimer (that System.Windows.Forms.Timer uses)
> the maximum value for the interval is USER_TIMER_MAXIMUM. That constant is
> defined in winuser.h as 0x7FFFFFFF
>
> There must be something else that's wrong in this case. Show your code
>
>     /claes
>
> "John" <John@nospam.infovis.co.uk> wrote in message
> news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
>> Got it now thanks. My only problem now is to set the interval to about 5
>> minutes. If the highest interval the timer can take is 32000 (32 seconds?)
>> then how does one get round it?
>>
>> Thanks again everyone.
>>
>> Regards
>>
>> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
>> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>>> Can we see the code?
>>>
>>
>
>
Author
30 Aug 2006 2:49 PM
Claes Bergefall
The first is a class too...

As I posted below I successfully used System.Windows.Forms.Timer with a 5
minute (i.e. 300 seconds)  timeout. Can you show me where this limitation of
the System.Windows.Forms.Timer control is documented (beacuse I can't find
it)?

   /claes

Show quoteHide quote
"Theo Verweij" <tverw***@xs4all.nl> wrote in message
news:%23yXHhd6yGHA.1292@TK2MSFTNGP03.phx.gbl...
>I think there is a misunderstanding between the readers.
> There are 2 types of timers available:
> 1. The timer control (System.Windows.Forms.Timer)
> 2. The timer class (System.Timers.Timer)
>
> The first one is a control, and has a limititation of 64,767 seconds.
> The second one is a class, and does not have this limitation.
>
>
> Claes Bergefall wrote:
>> I've never heard of a 32/64/whatever sec limitation (except on Windows
>> 3.x). Both of the following works fine on my machine:
>>
>> Timer1.Interval = 60000 '1 minute interval
>> Timer1.Start()
>>
>> Timer1.Interval = 300000 '5 minute interval
>> Timer1.Start()
>>
>>
>> According to the docs for SetTimer (that System.Windows.Forms.Timer uses)
>> the maximum value for the interval is USER_TIMER_MAXIMUM. That constant
>> is defined in winuser.h as 0x7FFFFFFF
>>
>> There must be something else that's wrong in this case. Show your code
>>
>>     /claes
>>
>> "John" <John@nospam.infovis.co.uk> wrote in message
>> news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
>>> Got it now thanks. My only problem now is to set the interval to about 5
>>> minutes. If the highest interval the timer can take is 32000 (32
>>> seconds?) then how does one get round it?
>>>
>>> Thanks again everyone.
>>>
>>> Regards
>>>
>>> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
>>> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>>>> Can we see the code?
>>>>
>>>
>>
Author
30 Aug 2006 3:03 PM
Claes Bergefall
I found it in MSDN:
http://msdn2.microsoft.com/en-us/library/xy0zeach.aspx

It actually says that the timer interval is limited to max 64 seconds. Looks
incorrect to me though. Setting it to 2 minutes correctly fires the Tick
event every 2 minutes as expected in my text application. And the underlying
API (SetTimer) doesn't have any 64 sec limitation so why would the Timer
class have it?

   /claes

Show quoteHide quote
"Claes Bergefall" <louplou@nospam.nospam> wrote in message
news:eWgUEMEzGHA.2640@TK2MSFTNGP06.phx.gbl...
> The first is a class too...
>
> As I posted below I successfully used System.Windows.Forms.Timer with a 5
> minute (i.e. 300 seconds)  timeout. Can you show me where this limitation
> of the System.Windows.Forms.Timer control is documented (beacuse I can't
> find it)?
>
>   /claes
>
> "Theo Verweij" <tverw***@xs4all.nl> wrote in message
> news:%23yXHhd6yGHA.1292@TK2MSFTNGP03.phx.gbl...
>>I think there is a misunderstanding between the readers.
>> There are 2 types of timers available:
>> 1. The timer control (System.Windows.Forms.Timer)
>> 2. The timer class (System.Timers.Timer)
>>
>> The first one is a control, and has a limititation of 64,767 seconds.
>> The second one is a class, and does not have this limitation.
>>
>>
>> Claes Bergefall wrote:
>>> I've never heard of a 32/64/whatever sec limitation (except on Windows
>>> 3.x). Both of the following works fine on my machine:
>>>
>>> Timer1.Interval = 60000 '1 minute interval
>>> Timer1.Start()
>>>
>>> Timer1.Interval = 300000 '5 minute interval
>>> Timer1.Start()
>>>
>>>
>>> According to the docs for SetTimer (that System.Windows.Forms.Timer
>>> uses) the maximum value for the interval is USER_TIMER_MAXIMUM. That
>>> constant is defined in winuser.h as 0x7FFFFFFF
>>>
>>> There must be something else that's wrong in this case. Show your code
>>>
>>>     /claes
>>>
>>> "John" <John@nospam.infovis.co.uk> wrote in message
>>> news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
>>>> Got it now thanks. My only problem now is to set the interval to about
>>>> 5 minutes. If the highest interval the timer can take is 32000 (32
>>>> seconds?) then how does one get round it?
>>>>
>>>> Thanks again everyone.
>>>>
>>>> Regards
>>>>
>>>> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
>>>> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>>>>> Can we see the code?
>>>>>
>>>>
>>>
>
Author
30 Aug 2006 7:00 PM
Theo Verweij
I also don't know why, but it is documented this way.
Maybe a microsoft employee can explain this?


Claes Bergefall wrote:
Show quoteHide quote
> I found it in MSDN:
> http://msdn2.microsoft.com/en-us/library/xy0zeach.aspx
>
> It actually says that the timer interval is limited to max 64 seconds. Looks
> incorrect to me though. Setting it to 2 minutes correctly fires the Tick
> event every 2 minutes as expected in my text application. And the underlying
> API (SetTimer) doesn't have any 64 sec limitation so why would the Timer
> class have it?
>
>    /claes
>
> "Claes Bergefall" <louplou@nospam.nospam> wrote in message
> news:eWgUEMEzGHA.2640@TK2MSFTNGP06.phx.gbl...
>> The first is a class too...
>>
>> As I posted below I successfully used System.Windows.Forms.Timer with a 5
>> minute (i.e. 300 seconds)  timeout. Can you show me where this limitation
>> of the System.Windows.Forms.Timer control is documented (beacuse I can't
>> find it)?
>>
>>   /claes
>>
>> "Theo Verweij" <tverw***@xs4all.nl> wrote in message
>> news:%23yXHhd6yGHA.1292@TK2MSFTNGP03.phx.gbl...
>>> I think there is a misunderstanding between the readers.
>>> There are 2 types of timers available:
>>> 1. The timer control (System.Windows.Forms.Timer)
>>> 2. The timer class (System.Timers.Timer)
>>>
>>> The first one is a control, and has a limititation of 64,767 seconds.
>>> The second one is a class, and does not have this limitation.
>>>
>>>
>>> Claes Bergefall wrote:
>>>> I've never heard of a 32/64/whatever sec limitation (except on Windows
>>>> 3.x). Both of the following works fine on my machine:
>>>>
>>>> Timer1.Interval = 60000 '1 minute interval
>>>> Timer1.Start()
>>>>
>>>> Timer1.Interval = 300000 '5 minute interval
>>>> Timer1.Start()
>>>>
>>>>
>>>> According to the docs for SetTimer (that System.Windows.Forms.Timer
>>>> uses) the maximum value for the interval is USER_TIMER_MAXIMUM. That
>>>> constant is defined in winuser.h as 0x7FFFFFFF
>>>>
>>>> There must be something else that's wrong in this case. Show your code
>>>>
>>>>     /claes
>>>>
>>>> "John" <John@nospam.infovis.co.uk> wrote in message
>>>> news:OrncNP3yGHA.5048@TK2MSFTNGP05.phx.gbl...
>>>>> Got it now thanks. My only problem now is to set the interval to about
>>>>> 5 minutes. If the highest interval the timer can take is 32000 (32
>>>>> seconds?) then how does one get round it?
>>>>>
>>>>> Thanks again everyone.
>>>>>
>>>>> Regards
>>>>>
>>>>> "Stuart Nathan" <stuart.nat***@homecall.co.uk> wrote in message
>>>>> news:encbx21yGHA.5072@TK2MSFTNGP03.phx.gbl...
>>>>>> Can we see the code?
>>>>>>
>
>
Author
30 Aug 2006 11:28 AM
C-Services Holland b.v.
John wrote:

> Got it now thanks. My only problem now is to set the interval to about 5
> minutes. If the highest interval the timer can take is 32000 (32 seconds?)
> then how does one get round it?
>
> Thanks again everyone.
>
> Regards
>

How about storing the time when you start then let the timer check every
second orso to check the timespan between the current time and the
stored start time.




--
Rinze van Huizen
C-Services Holland b.v