![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 |
My System Specs![]() |
| | #2 (permalink) |
| | Re: automtic closing - Pretty easy 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" <klaas@xxxxxx> wrote in message news:%23YzcdpmiIHA.1944@xxxxxx Quote: > 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 > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: automtic closing - Pretty easy 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: Quote: > 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" <klaas@xxxxxx> wrote in message > news:%23YzcdpmiIHA.1944@xxxxxx Quote: > > 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 > > |
My System Specs![]() |
| | #4 (permalink) |
| | RE: automtic closing 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: Quote: > 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 > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: automtic closing 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" <FamilyTreeMike@xxxxxx> schreef in bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@xxxxxx Quote: > 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: > Quote: >> 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 >> >> >> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: automtic closing 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" <klaas@xxxxxx> schreef in bericht news:%23gBTFY2iIHA.3448@xxxxxx Quote: > 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" <FamilyTreeMike@xxxxxx> schreef in > bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@xxxxxx Quote: >> 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: >> Quote: >>> 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 >>> >>> >>> > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: automtic closing 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" <klaas@xxxxxx> wrote in message news:OvGZTJUjIHA.1944@xxxxxx Quote: > 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" <klaas@xxxxxx> schreef in bericht > news:%23gBTFY2iIHA.3448@xxxxxx Quote: >> 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" <FamilyTreeMike@xxxxxx> schreef in >> bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@xxxxxx Quote: >>> 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 >>>> >>>> >>>> >> > |
My System Specs![]() |
| | #8 (permalink) |
| | Re: automtic closing hi, i'am sorry, but i'am only a beginner. Where do i write the "global static (shared) boolean " I've tried to declare it above the public class of my mainform, but he underlines allways the static as unknown. Public Static shutdown As Boolean Public Class frmMainform Therefor I cannot reach the variable on antoher form. thx Klaas "RobinS" <robins@xxxxxx> schreef in bericht news:Q4Odna819fiJoHranZ2dnUVZ_saknZ2d@xxxxxx Quote: > 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" <klaas@xxxxxx> wrote in message > news:OvGZTJUjIHA.1944@xxxxxx Quote: >> 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" <klaas@xxxxxx> schreef in bericht >> news:%23gBTFY2iIHA.3448@xxxxxx Quote: >>> 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" <FamilyTreeMike@xxxxxx> schreef in >>> bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@xxxxxx >>>> 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 >>>>> >>>>> >>>>> >>> >>> >> |
My System Specs![]() |
| | #9 (permalink) |
| | Re: automtic closing Are you doing VB or C#? You need to create a new class that is accessible from the whole application. Make it public and static (C#) or shared (VB). Inside it, declare the variable. Here it is in C#: public static class GlobalVariables { public static bool Shutdown; } Then you can access it like this: if (GlobalVariables.Shutdown) { this.Close(); } Does that help? RobinS. "klaas" <klaas@xxxxxx> wrote in message news:ezOZnrdjIHA.3512@xxxxxx Quote: > hi, > > i'am sorry, but i'am only a beginner. Where do i write the "global static > (shared) boolean " > I've tried to declare it above the public class of my mainform, but he > underlines allways the static as unknown. > Public Static shutdown As Boolean > > Public Class frmMainform > > Therefor I cannot reach the variable on antoher form. > > thx Klaas > "RobinS" <robins@xxxxxx> schreef in bericht > news:Q4Odna819fiJoHranZ2dnUVZ_saknZ2d@xxxxxx Quote: >> 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" <klaas@xxxxxx> wrote in message >> news:OvGZTJUjIHA.1944@xxxxxx Quote: >>> 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" <klaas@xxxxxx> schreef in bericht >>> news:%23gBTFY2iIHA.3448@xxxxxx >>>> 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" <FamilyTreeMike@xxxxxx> schreef >>>> in bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@xxxxxx >>>>> 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 >>>>>> >>>>>> >>>>>> >>>> >>>> >>> >>> > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| dat keeps closing ie8 | Vista security | |||
| Windows Mail keeps closing because DEP is closing for security | Vista mail | |||
| Unable to turn on Automtic Updates | .NET General | |||
| Closing WLM | Live Mail | |||
| closing lid | Vista General | |||