Solved

Closing VB Application

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now