?
Solved

MDI FORM  closing problem

Posted on 2003-03-20
3
Medium Priority
?
165 Views
Last Modified: 2011-09-20
Hi all
i am programming a simple application using vbasic, i have a MDIForm and 2 other child form of this MDI. When i start the mdi form i open the 2 other child. In the Unload event of the MDI Form i want to ask the user if he is sure he wants to exit but what happen is that the 2 child forms are closed before the msgbox appear.
Any help please
MMalwan
0
Comment
Question by:mmalwan
[X]
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
3 Comments
 
LVL 5

Accepted Solution

by:
Cimperiali earned 210 total points
ID: 8172415
Use the QueryUnload event:

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim retVar As VbMsgBoxResult
retVar = MsgBox("Do you want to quit?", vbYesNo)
If retVar = vbNo Then
     Cancel = True 'stop unloading
End If
End Sub
0
 
LVL 1

Expert Comment

by:Piter
ID: 8172456
Use "Exit" Menu in MDI Form and
in code side

Private Sub exit_Click()
On Error Resume Next
Unload ActiveForm

dim i as integer
 i = Msgbox("Are you sure you want to exit",vbYesNo)
 if i = 6 then
  unload me
 end if
End Sub
0
 

Author Comment

by:mmalwan
ID: 8179377
thanks all
this is what i want
MMAlwan
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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
Course of the Month8 days, 8 hours left to enroll

764 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