Solved

STOP CLOSING PARENT MDI FORM

Posted on 2006-06-27
6
302 Views
Last Modified: 2008-02-01
Hi,

I have a winforms based MDI application.
When a user clicks on the close button on the Main MDI, amongst many open child forms, one of forms has a prompt for closure like

"Do you want to close this form?, OK / CANCEL"

Is it possible to stop the closing of the main MDI depending on the user's choice of closing the child form?

As of now, the application continues back to the main MDI execution and closes the main MDI, regardless of whether the user has clicked OK or CANCEL

If yes, would appreciate some sample code...
0
Comment
Question by:AmitBAcharya
  • 2
  • 2
6 Comments
 
LVL 5

Expert Comment

by:t_itanium
ID: 16998852
in the closing event of the mdi form:  to get the closing event select the mdi form and select the closing event the code will appear...

then you have to show a messagebox with yesno buttons..

dim x as integer
x=MessageBox.Show("are you sure?","Confirm","sd",System.Windows.Forms.MessageBoxButtons.YesNo,System.Windows.Forms.MessageBoxIcon.Exclamation);

if x=6 then

else

e.cancel=true

end if
0
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 500 total points
ID: 16998965
Well the MDI should not close at all
What version are you using ?
in VS2005 if one of the child forms cancels the close it is propogated and the parent does not close as well
check if you have set
    childForm.Parent = MDIForm

0
 

Author Comment

by:AmitBAcharya
ID: 16999271
I am not able to do that directly with the application architecture, as the parent form and child forms are in separate MS.NET solutions and referred in a complex hierarchy.

Is there a way to stop all processing upon clicking cancel while closing a child form. The control should not go back to the parent form.
0
 
LVL 5

Expert Comment

by:t_itanium
ID: 16999365
can you clarify your canse more. please... it is abit unclear and need details... as far as i understand to prevent the form from closing e.cancel=true will do so...and checking for the NO respond of messagebox it returns 7 as integer...
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 16999366
How are you showing the child form ?
Can you post the code

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 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