473,326 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Timer driving me nuts

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
Aug 28 '06 #1
12 2094

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
Aug 28 '06 #2
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" <in**************@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.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

Aug 28 '06 #3
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
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" <in**************@yahoo.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.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

Aug 28 '06 #4
Can we see the code?
Aug 29 '06 #5
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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
Can we see the code?

Aug 29 '06 #6
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
"John" <Jo**@nospam.infovis.co.ukschreef in bericht
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
>Can we see the code?


Aug 29 '06 #7
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" <Jo**@nospam.infovis.co.ukwrote in message
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
>Can we see the code?


Aug 29 '06 #8
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" <Jo**@nospam.infovis.co.ukwrote in message
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
>>Can we see the code?

Aug 29 '06 #9
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
Aug 30 '06 #10
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" <tv******@xs4all.nlwrote in message
news:%2****************@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" <Jo**@nospam.infovis.co.ukwrote in message
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
Can we see the code?

Aug 30 '06 #11
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" <lo*****@nospam.nospamwrote in message
news:eW**************@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" <tv******@xs4all.nlwrote in message
news:%2****************@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" <Jo**@nospam.infovis.co.ukwrote in message
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl...
Can we see the code?
>


Aug 30 '06 #12
I also don't know why, but it is documented this way.
Maybe a microsoft employee can explain this?
Claes Bergefall wrote:
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" <lo*****@nospam.nospamwrote in message
news:eW**************@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" <tv******@xs4all.nlwrote in message
news:%2****************@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" <Jo**@nospam.infovis.co.ukwrote in message
news:Or**************@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" <st***********@homecall.co.ukwrote in message
news:en**************@TK2MSFTNGP03.phx.gbl.. .
>Can we see the code?
>>

Aug 30 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Keiron Waites | last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php If you mouse over the fields, you will see that text is shown on the right. The text makes the other fields move when...
12
by: Marty | last post by:
It seems all of the sudden that user controls that contain images are referencing image sources relative to the document that I drop the control on. This obviously does not work beacuase the...
0
by: Simon Harris | last post by:
Ok, this really is driving me nuts!!! :( 'All' I am trying to do is get the value of a named element. My XML doc is: <?xml version="1.0" encoding="utf-16" standalone="yes" ?> - <Page>...
4
by: trond | last post by:
Hello all, Before I start I'd like to point out that I am a complete novice when it comes to asp.net - My background is in network and operating systems, and although I have been doing a bit of...
3
by: Kris Palmer | last post by:
hi, can somebody explain this problem? it's driving me crazy! i have a requirement to dynamically create a variable quantity of timers with associated start button based on the contents of a...
2
by: mitsura | last post by:
Hi, I need to read a simle XML file. For this I use the SAX parser. So far so good. The XML file consist out of number of "Service" object with each object a set of attributes. I read...
4
by: mattlightbourn | last post by:
Hi all, I have a problem which has been driving me nuts. Crosstab queries! I have a database witch a few different tables to do with garment manufacturing. I have a table for a client...
3
by: DuncanIdaho | last post by:
Hello experts IE 7.0.5730.11 Opera 9.27 Firefox 2.0.0.14 This problem only occurs in Opera and Firefox (amazing, IE does something right, or maybe not) Anyway, the problem is that when I...
4
by: damjanovic | last post by:
Hi all, I have a DB which is designed to have 1 admin and several users on at the same time. The users and admin all work with the same form, called frmOrders, which is a continuous form that...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.