Results 1 to 5 of 5
  1. #1
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Exit If No Activity (2000, SR1)

    I currently have a project that opens to a "Welcome" form where a user clicks on a button to open a password form. Once the correct user password is entered, a "User Options" form opens. From this form, of course, multiple options are available, and after any selected option has been completed, the user is returned to the "User Options" form. This form, in addition to all of the options available, also has an "Exit" button which logs the user off and then returns to the "Welcome" screen.

    My question is, if the user does NOT exit this form, is there a way to close the form and log the user off automatically after a period of time? The Timer Event seems to be the logical way to do this, but, this form remains open (although invisible) while any of the available options are being performed. I obviously don't want the user logged off while he/she is performing some task.

    Thanks in advance for any suggestions.

    John
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Exit If No Activity (2000, SR1)

    In the timer event, I'd check the Forms collection to see if any other forms are open. If not, then you can consider whether/not to exit.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Exit If No Activity (2000, SR1)

    Mark,

    Thanks for the response.

    If it is safe to do an auto-exit, two forms ONLY are loaded - the Options form and another hidden form which is holding the user's ID (all of the available options are tied to this ID). What would be the coding to determine if ONLY these two forms are loaded?

    In other words, how to code If (IsLoaded("frmOptions")) Or If (IsLoaded("frmID")) AND NOTHING ELSE IS LOADED.

    John
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Exit If No Activity (2000, SR1)

    The Forms collection contains all open forms. The Count property of this collection indicates the number of open forms. So the additional condition you can check for is

    Forms.Count = 2

  5. #5
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Exit If No Activity (2000, SR1)

    Thanks Hans. That did it.

    John
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •