473,320 Members | 1,952 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,320 software developers and data experts.

Timer as form inactivity monitor - tick event firing unexpectedly

Dan
Hi,

I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on
the form. Users have reported the form closing in the middle of them typing
or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if
rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).

Regards,

Dan
Nov 20 '05 #1
4 3302
On your keydown / mouseevents are you calling your timer to stop? reset the
interval, and start again? (reseting the interval isn't important really..)
"Dan" <no**********@sorrynospamwanted.com> wrote in message
news:5F*******************@twister.nyroc.rr.com...
Hi,

I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on the form. Users have reported the form closing in the middle of them typing or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).

Regards,

Dan

Nov 20 '05 #2
Cor
Hi Dan,

When I was you I just would check my reset procedure setting the times
something more narrow.

But I would never use a thread timer, that one I could until now not reset.
(It goes direct in his own thread when it start and fires even if the
program is ended).

For this I find the forms timer the nicest.

Just my thought,

Cor
Nov 20 '05 #3
* "Dan" <no**********@sorrynospamwanted.com> scripsit:
I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on
the form. Users have reported the form closing in the middle of them typing
or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if
rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).


Post the code you use to reset the timer.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>
Nov 20 '05 #4
Dan

Private Sub ResetTimer()
timer1.stop()
timer1.start()
End Sub

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Dan" <no**********@sorrynospamwanted.com> scripsit:
I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have elapsed without any user activity I want the form to close. I stop/start the timer at button clicks and keydown events etc of the various controls on the form. Users have reported the form closing in the middle of them typing or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this occur once during testing where an event fired that should have reset the timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have elapsed instead of 60 then don't do anything). This of course won't help if rather than a timer failure, its the keydown and other events that are not firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).


Post the code you use to reset the timer.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>

Nov 20 '05 #5

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

Similar topics

3
by: Lloyd Sheen | last post by:
I have a problem where I cannot read (all the time) a file when caught by the FileSystemWatcher. What I have done to get past this is create an array of events (when I receive one I add it to the...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
5
by: Jason | last post by:
I have an application that uses a timer. I've created a function called TickEvent that I "assigned" to the timer1.Tick event: this.timer1.Interval = 1000; this.timer1.Tick += new...
7
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly...
9
by: Brett | last post by:
I have a timer enabled on a form with an interval of 200. I place a break point on the first line in the timer tick event, which is a try. After a few events go on, the timer seems to stop. My...
8
by: RobcPettit | last post by:
Hi Im using System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += new ElapsedEventHandler(onTimer); myTimer.Interval = 1000; myTimer.Start(); and getting error onTimer does...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.