Solved

Closing VB Application

Posted on 1998-07-02
1
124 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

803 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