Never mind I found out how to do it. In the mainframe's FormClosing event the
Cancel property will set to true if any mdi child canceled his close. In that
case do a return:
private void Frame_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.Cancel == true)
return;
}
Rich Sienkiewicz
DragonPoint Software
rich@dragonpoint.com
[quoted text, click to view] "RSienkiewicz" wrote:
> In a WinForm, in the FormClosing event, there is an opportunity to cancel the
> close by setting the Cancel property of the FormClosingEventArgs to true.
> This is typically done when there is unsaved data on the form and the user,
> when asked if they want to close the form and lose data or not, says not to
> close."
>
> Our app is a MDI type that holds several windows. When the app gets closed,
> each form in it gets closed, getting their FormClosing event, then the
> mainframe form gets its FormClosing event. Problem I have is that the
> mainframe needs to know if any of the forms in it canceled their close
> (because of the above) and if they did the mainframe will cancel the app
> closing. But how can the main form, in his FormClosing event, know that? Is
> there a way?
>
> Thanks
> Rich Sienkiewicz
> DragonPoint Software
> rich@dragonpoint.com
Actually I had to do nothing, like the below, I just had to ensure that the
mdi children canceled their close.
Rich
[quoted text, click to view] "RSienkiewicz" wrote:
> Never mind I found out how to do it. In the mainframe's FormClosing event the
> Cancel property will set to true if any mdi child canceled his close. In that
> case do a return:
>
> private void Frame_FormClosing(object sender, FormClosingEventArgs e)
> {
> if (e.Cancel == true)
> return;
> }
>
> Rich Sienkiewicz
> DragonPoint Software
> rich@dragonpoint.com
>
>
> "RSienkiewicz" wrote:
>
> > In a WinForm, in the FormClosing event, there is an opportunity to cancel the
> > close by setting the Cancel property of the FormClosingEventArgs to true.
> > This is typically done when there is unsaved data on the form and the user,
> > when asked if they want to close the form and lose data or not, says not to
> > close."
> >
> > Our app is a MDI type that holds several windows. When the app gets closed,
> > each form in it gets closed, getting their FormClosing event, then the
> > mainframe form gets its FormClosing event. Problem I have is that the
> > mainframe needs to know if any of the forms in it canceled their close
> > (because of the above) and if they did the mainframe will cancel the app
> > closing. But how can the main form, in his FormClosing event, know that? Is
> > there a way?
> >
> > Thanks
> > Rich Sienkiewicz
> > DragonPoint Software
> > rich@dragonpoint.com
Don't see what you're looking for? Try a search.