automtic closing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • klaas

    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


  • simon-john roberts

    #2
    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.exi t(),
    maybe a DO YOU WANT TO EXIT popup would be good 1st.

    That'll do.


    "klaas" <klaas@sdmlfk.n lwrote in message
    news:%23Yzcdpmi IHA.1944@TK2MSF TNGP02.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
    >

    Comment

    • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

      #3
      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:
      You will need: A timer, A method.
      >
      put together a shutdown() method that disposes of stuff (like connections)
      and does a Application.exi t(),
      maybe a DO YOU WANT TO EXIT popup would be good 1st.
      >
      That'll do.
      >
      >
      "klaas" <klaas@sdmlfk.n lwrote in message
      news:%23Yzcdpmi IHA.1944@TK2MSF TNGP02.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
      >

      Comment

      • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

        #4
        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:
        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
        >
        >
        >

        Comment

        • klaas

          #5
          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 @discussions.mi crosoft.comschr eef in
          bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@mi crosoft.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
          >>
          >>
          >>

          Comment

          • klaas

            #6
            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@sdmlfk.n lschreef in bericht
            news:%23gBTFY2i IHA.3448@TK2MSF TNGP04.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" <FamilyTreeMike @discussions.mi crosoft.comschr eef in
            bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@mi crosoft.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
            >>>
            >>>
            >>>
            >
            >

            Comment

            • RobinS

              #7
              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@sdmlfk.n lwrote in message
              news:OvGZTJUjIH A.1944@TK2MSFTN GP02.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" <klaas@sdmlfk.n lschreef in bericht
              news:%23gBTFY2i IHA.3448@TK2MSF TNGP04.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" <FamilyTreeMike @discussions.mi crosoft.comschr eef in
              >bericht news:41ED64EF-D9B0-4FC6-8B0D-06BBB920DFF8@mi crosoft.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
              >>>>
              >>>>
              >>>>
              >>
              >>
              >
              >

              Comment

              Working...