[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Query Unload Prompt with an option to disable.

Posted on 2006-05-17
5
Medium Priority
?
187 Views
Last Modified: 2011-08-18
I added a message box to ask user if they really want to quit the app or not - something like
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20876764.html

How do I add a check box so that the user can choose whether to show the message or not (disable the exit prompt)?

0
Comment
Question by:larrysy
5 Comments
 
LVL 11

Expert Comment

by:TreyH
ID: 16705808
'A crude example:

Option Explicit

Dim m_bOptionQuit       As Boolean

Private Sub Check1_Click()
    Select Case Check1.Value
        Case vbChecked
            m_bOptionQuit = True
        Case vbUnchecked
            m_bOptionQuit = False
    End Select
   
End Sub

Private Sub Form_Load()
    m_bOptionQuit = True
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If m_bOptionQuit Then
        If MsgBox("Do you really want to quit?", vbOKCancel) = vbCancel Then
            Cancel = 1
        End If
    End If
End Sub

'I used a simple check box to toggle the module level variable but usually other methods are used to store user settings
' and then retrieved upon program startup.
0
 
LVL 12

Expert Comment

by:jkaios
ID: 16713961
Store the value of your module-level variable "m_bOptionQuit" into a file (i.e., INI file) or in the Registry.

The next time your program loads, you just read the value from the INI file or the Registry and then assign
it to the "m_bOptionQuit" variable followed by setting the "Value" property of the CheckBox control.
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 150 total points
ID: 16715487

you have to create a custom yes/no form, or use subclassing
0
 
LVL 11

Expert Comment

by:TreyH
ID: 16731155
lol
0
 

Author Comment

by:larrysy
ID: 16732877
My question is if there is any easy way to add a check box in the pop-up box itself (not the main form) for the purpose.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Suggested Courses

830 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