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

automtic closing

Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this on
the net?

regards, Klaas
Mar 20 '08 #1
6 1152
You will need: A timer, A method.

put together a shutdown() method that disposes of stuff (like connections)
and does a Application.exit(),
maybe a DO YOU WANT TO EXIT popup would be good 1st.

That'll do.
"klaas" <kl***@sdmlfk.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this on
the net?

regards, Klaas
Mar 20 '08 #2
If going this route, a method that resets the timer if there is activity
(keypress, mouse movement) will need to be added. Without this, all will
shutdown after ten minutes regardless.

"simon-john roberts" wrote:
You will need: A timer, A method.

put together a shutdown() method that disposes of stuff (like connections)
and does a Application.exit(),
maybe a DO YOU WANT TO EXIT popup would be good 1st.

That'll do.
"klaas" <kl***@sdmlfk.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this on
the net?

regards, Klaas
Mar 20 '08 #3
You are basically going to do what is necessary for developing a screen
saver. There should be plenty of examples of doing something similar to
this. The first I found is
http://weblogs.asp.net/jdanforth/arc...21/454219.aspx.

You will code whatever you want to do at the point where it is determined
the user is idle.

It is a much more difficult thing if you are talking about the user being
idle in your application rather than the system. For example, if your user
gets carried away writing some emails, do you consider this idle within your
application?

By the way... Why would your connections remain open if you are not using
them? They should be closed when you are through with them.
"klaas" wrote:
Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this on
the net?

regards, Klaas
Mar 20 '08 #4
hi,

thank you for your replay.
I want to close my application automaticly because some users often forget
to close the program properly and get awway and the program remains still
open with an open connection to the DB.

If it shuts down after a period of inactivaty , the connection to the DB
will close . I prefer to idlle the thime within the application.

thx, Klaas
"Family Tree Mike" <Fa************@discussions.microsoft.comschreef in
bericht news:41**********************************@microsof t.com...
You are basically going to do what is necessary for developing a screen
saver. There should be plenty of examples of doing something similar to
this. The first I found is
http://weblogs.asp.net/jdanforth/arc...21/454219.aspx.

You will code whatever you want to do at the point where it is determined
the user is idle.

It is a much more difficult thing if you are talking about the user being
idle in your application rather than the system. For example, if your
user
gets carried away writing some emails, do you consider this idle within
your
application?

By the way... Why would your connections remain open if you are not using
them? They should be closed when you are through with them.
"klaas" wrote:
>Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to
a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this on
the net?

regards, Klaas

Mar 21 '08 #5
Hi,
i spent a lot of time on the web, but i can't figure it out by myself. i Saw
not a suitable example which i can use in my application.
A little more help will be very appreciated.

thx Klaas
"klaas" <kl***@sdmlfk.nlschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
hi,

thank you for your replay.
I want to close my application automaticly because some users often forget
to close the program properly and get awway and the program remains still
open with an open connection to the DB.

If it shuts down after a period of inactivaty , the connection to the DB
will close . I prefer to idlle the thime within the application.

thx, Klaas
"Family Tree Mike" <Fa************@discussions.microsoft.comschreef in
bericht news:41**********************************@microsof t.com...
>You are basically going to do what is necessary for developing a screen
saver. There should be plenty of examples of doing something similar to
this. The first I found is
http://weblogs.asp.net/jdanforth/arc...21/454219.aspx.

You will code whatever you want to do at the point where it is determined
the user is idle.

It is a much more difficult thing if you are talking about the user being
idle in your application rather than the system. For example, if your
user
gets carried away writing some emails, do you consider this idle within
your
application?

By the way... Why would your connections remain open if you are not
using
them? They should be closed when you are through with them.
"klaas" wrote:
>>Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive to
a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this
on
the net?

regards, Klaas


Mar 24 '08 #6
You'll have to put timers on all your forms and check for keystrokes, etc.
It's a lot of trouble.

If what you're trying to do is be able to kick the users out of their
application so they no longer have the shared Access database locked, here's
an alternate idea that I have used before, with much success:

I had an application where my main form stayed open all the time, although
sometimes it was hidden. It opened the connection to the database at
startup, and closed it at shutdown.

I put a timer on the main form. Every couple of minutes, the timer fired,
and it checked to see if there was a file called shutdown.txt in the same
folder as the Access database. The contents of the folder are not relevant,
just the presence of a file with that name.

I had one global static (shared) boolean variable, let's call it
globalShutdown. When the timer fired, if the file was found, the
globalShutdown value was set to true.

In the main form, when globalShutdown was true, it would close all of the
forms, then close itself and the connection to the database.

In each of the other forms' form_closing event, if globalShutdown was true,
it would only close itself. I had to put that in because some of the forms
had Exit options that would close the main form in addiiton to that form,
which you wouldn't want to do if the form was being closed BY the main form.

In the loops in my reports, I put in a check for globalShutdown, and when
true, exited processing and returned to the calling form.

In the calling form, after the report was finished running, it checked
globalShutdown, and didn't continue if it was true.

So when I wanted to shut people out of the database, I just put a file with
that name in the same folder. Within a couple of minutes, everybody was out,
whether they were sitting at their desk or not.

In the main form, when it closes everything (including the link to the
database), the last thing I would do is put up a messagebox saying the
application was being closed because database maintenance was being
performed. The app would sit there at the messagebox for when the user came
back to his desk, but the app wouldn't be connected to the database.

Another thing I did was when the user started up the application, before
starting up the connection to the database, check for the file. If it's
there, give them a message telling them it is being maintained and they
should try again later, and exit the application.

It's not as complicated as it sounds. It worked really well, without fail,
and was a lot easier than trying to figure out how long it's been since the
user last clicked on something or typed something in one of the screens.
Hope this helps.

RobinS.
-------------------------------------------------------
"klaas" <kl***@sdmlfk.nlwrote in message
news:Ov**************@TK2MSFTNGP02.phx.gbl...
Hi,
i spent a lot of time on the web, but i can't figure it out by myself. i
Saw not a suitable example which i can use in my application.
A little more help will be very appreciated.

thx Klaas
"klaas" <kl***@sdmlfk.nlschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>hi,

thank you for your replay.
I want to close my application automaticly because some users often
forget to close the program properly and get awway and the program
remains still open with an open connection to the DB.

If it shuts down after a period of inactivaty , the connection to the DB
will close . I prefer to idlle the thime within the application.

thx, Klaas
"Family Tree Mike" <Fa************@discussions.microsoft.comschreef in
bericht news:41**********************************@microsof t.com...
>>You are basically going to do what is necessary for developing a screen
saver. There should be plenty of examples of doing something similar to
this. The first I found is
http://weblogs.asp.net/jdanforth/arc...21/454219.aspx.

You will code whatever you want to do at the point where it is
determined
the user is idle.

It is a much more difficult thing if you are talking about the user
being
idle in your application rather than the system. For example, if your
user
gets carried away writing some emails, do you consider this idle within
your
application?

By the way... Why would your connections remain open if you are not
using
them? They should be closed when you are through with them.
"klaas" wrote:

Hi,
i'am writing a program in vb.net 2005 based on an access database.
Now, i want to close my program automaticly when the user is inactive
to a
period of eg 10 minutes. I want to close all mine connections to the
database en quit the program.
is there a procedure to achive this or even better an example of this
on
the net?

regards, Klaas


Mar 24 '08 #7

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

Similar topics

5
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here...
1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
6
by: Al the programmer | last post by:
I want to catch the Closing event for my form. I created a test windows app using the wizard. I then create the Closing event by clicking the lightning bolt on the properties pane. The code is...
1
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: Marius Groenendijk | last post by:
Dear Group, I have a MDI with children which may be editing data. If a MDI child closes its Closing handler asks a question 'exit w/out saving?'. On closing the MDI its pops a question 'Exit...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
4
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in one Closing routine he will not be asked again by...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
1
by: Paul Rubin | last post by:
it looks like contextlib.closing fails to be idempotent, i.e. wrapping closing() around another closing() doesn't work. This is annoying because the idea of closing() is to let you use legacy...
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...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.