Results 1 to 10 of 10

Thread: How to close the application when clicking on the close button in title bar

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    How to close the application when clicking on the close button in title bar

    guys,

    how to close the application when the user click on the close button on the title bar?


    pls suggest

  2. #2

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    is there any way that i can manually close the application or perform any action
    on the close button?

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to close the application when clicking on the close button in title bar

    There are several articles about this in the "Closing your forms/program" section of our Classic VB FAQs (in the FAQ forum, which is shown near the top of our home page), such as: How should I close my form/program/class?

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    but what i need is when the user clicks the close button in the title bar (The 'X' button), i want to close an open db connection? how to do that? any idea?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    well, i have found myself something interesting:

    When the form close ('X') button is clicked, it initiates a form_unload event rite?
    shall we close all the forms that are loaded and the open connections that are still open to the database and all the closing operations there? is it safe? any concerns reg tat?

    now will this event close all the connections that are made to the db in an multiuser environment?


    heh heh guys pls bare with me ! getting these hell a lotta Questions now.

    suggest pls

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to close the application when clicking on the close button in title bar

    Those questions are all answered by the article that I linked to.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    sure thanks buddy. will check it out for sure. thanks for your help and that valuable link.

    will c ya soon. back again

  8. #8

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    hi i read the article but the question in my mind is:

    my application is expected to run from many client machine each connecting to a Database(MS-access) in file server.
    So each user will establish a connection when he/she runs my application.
    i wanna make the application like, if the user clicks the close button in title bar, the connection to db made by the particular client should close.

    now when i use this query_unload() event will it close all the connections made to the db? or will it close only the current client's connection?


    pls reply

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to close the application when clicking on the close button in title bar

    The _QueryUnload event should not be used to unload anything (only to allow the user to confirm if they want to close the form/program, if apt), as explained in the article - you should really be using _Unload instead.


    As to what closes (and even if it actually closes), like everything in programming, depends on the code you use.. but based on the level of questions you are asking, I doubt that you have the knowledge to communicate with other instances of your program.

    Assuming that is true, the connection will just be the one declared in that current instance of your program, so closing it will only affect the current instance.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    20

    Re: How to close the application when clicking on the close button in title bar

    Thank you man. i tried it on myself and got the result.

    sorry for bugging with a lotta questions. Thats's my job !

    c ya

Posting Permissions

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



Click Here to Expand Forum to Full Width