?
Solved

Closing VB Application

Posted on 1998-07-02
1
Medium Priority
?
128 Views
Last Modified: 2010-05-03
I am using VB5.0 with MSSqlServer. My VB based application has a normal windows features (like three buttons at the top right of the title bar for 1.minimizing, 2.restoring 3. closing the window. I don't want user to close the window with this 'X' button push option as I am to do some processing before closing. There could be two ways to handle it :
1) disable 'X' button i.e. the right most button on the title bar.
2) i have option to program the functionality of this 'X' button so that I can attach my 'Close Window' processing code with it.
I wish to have an early reply.
0
Comment
Question by:rolee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
swilt earned 120 total points
ID: 1464774
To stop the Form unloading when pressing 'X' button

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If UnloadMode = vbFormControlMenu Then Cancel = 1
End Sub

'Close Window' processing should be located in the Unload Event, that way no matter how the window is closed the code will run

Private Sub Form_Unload(Cancel As Integer)
    'My Close code
End Sub

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question