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
Solved

Closing VB Application

Posted on 1998-07-02
1
125 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
1 Comment
 
LVL 2

Accepted Solution

by:
swilt earned 30 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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 In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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