B
Bamse
hi,
I have 2 forms, one is MDI, one is child of the before mentioned one;
when the user tries to close the child, the form is checked whether the data
within changed;
if data changed, the user is prompted to: Save/Not Save/Cancel
if Save is clicked - the data is saved and the form closes
if Not save is clicked - the data is not saved and the form closes
if Cancel is clicked - the data is not saved and the form should NOT close
I've overrided OnClosing() and made a function which returns false if the
user choosed Cancel, setting e.Cancel = true to cancel closing
protected override OnClosing(System.ComponentModel.CancelEventArgs e)
{
if (!IsOkToClose())
e.Cancel = true;
//base.OnClosing(e);
}
this method is mentioned in many sources (MSDN, google, etc)
still, this code does not work, the form closes anyway
someone can help?
Thank you,
Daniel
I have 2 forms, one is MDI, one is child of the before mentioned one;
when the user tries to close the child, the form is checked whether the data
within changed;
if data changed, the user is prompted to: Save/Not Save/Cancel
if Save is clicked - the data is saved and the form closes
if Not save is clicked - the data is not saved and the form closes
if Cancel is clicked - the data is not saved and the form should NOT close
I've overrided OnClosing() and made a function which returns false if the
user choosed Cancel, setting e.Cancel = true to cancel closing
protected override OnClosing(System.ComponentModel.CancelEventArgs e)
{
if (!IsOkToClose())
e.Cancel = true;
//base.OnClosing(e);
}
this method is mentioned in many sources (MSDN, google, etc)
still, this code does not work, the form closes anyway
someone can help?
Thank you,
Daniel