473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Form_QueryUnload

34
Hi all, need some light on this....

I have a form with sizable border.. and it has this three boxes on the top right hand side, the minimize, maximize, and close button..


Problem:
what i wish to do is.. when i click the close button the form should unload but before that, a message box appear to confirm whether are u sure to exit the program or not.. the problem is when i click "NO" the program still terminate... it supposedly not to terminate and back to form's current state...

i have this code:

Sub Form_QueryUnload .

ask= ( Msgbox....)

if ask = 6 (yes) then
Unload Me
Elseif ask = 7 then
Exit Sub
End if


Do i got the right idea.. or is there any other way to do this..
Please enlighten me on this ....Thanks in anticipation...
Oct 31 '07 #1
3 3745
9815402440
180 100+
hi
add following code in the Form_Unload Event

If MsgBox("Do you want to Close?", vbYesNo) = vbNo Then
Cancel = 1
End If


regards
manpreet singh dhillon hoshiarpur
Oct 31 '07 #2
GROG
34
Thanks.. will try...
Oct 31 '07 #3
GROG
34
Thanks.. it worked.... God bless u..
Nov 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I...
7
by: Steve | last post by:
Hi Huys, When the "X" is pressed, I know that QueryUnload is called. I want to be able to put up a box, asking the user if they are sure.. If yes then the programme will end. If the answer...
6
by: Matthew Wells | last post by:
I am trying to load a form (load Me) without the form becoming visible. If I try me.hide or me.visible = false, they load the form and the form blinks before becoming invisible. Is there a way to...
2
by: Kevin Robinson | last post by:
Can anyone please help with a problem. My application uses an Access database and if I use my exit buttons setting db to nothing the database is closed down correctly. However if the X is...
1
by: Mchuck | last post by:
OK, my question has to do with identifing who sent the order to close a form. Basically, when the code goes into the Form_Closing event, there are two parameters passed in: "sender" as an "Object"...
3
by: Nicolas Poirier | last post by:
I successfully made a system tray application. When I do shut down the computer, how does the computer can instruct my application to shut down? For the moment, if I don't quit my application,...
7
by: alan | last post by:
Hello, When the user try the close the application (click the top right side button "X"), I would like to do a checking first. If the checking return false, prevent the application terminate....
4
by: Woo Mun Foong | last post by:
My app sits quitely on the system tray of a file serve, monitoring some users' predefined files. How can I trap the system shutdown message and display a warning. User should be allow to abort...
2
by: muddasirmunir | last post by:
i am using vb6 i want to restirct user to close a form if it has a blank field for e-g if user did not write name is the box and he tries to close the form by clicking on the croos button at...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.