Stopping DialogResult.OK cascading through windows
I currently have an application (yes, it's an assignment, but this is just me cleaning up the app for better presentation) that opens a dialog window, which can open another window for confirmation of a deletion. Clicking cancel on this second dialog window cascades down to the first dialog window, and returns everything back to the main application window.
How can I prevent this from happening? What work arounds are there?
Code:
// example
private void ShowAppointmentWindow()
{
ApptWindow newWindow1 = new ApptWindow();
if(newWindow1.ShowDialog() == DialogResult.OK)
{
// do some stuff saving the appointment basically
}
}
// then
private void ShowDeleteBox()
{
if(MessageBox.Show("blah","Sure?", *etc etc*) == DialogResult.OK)
{
// do some stuff to delete
}
}
Yes it's an assignment, but this aside, it's done, literally ready to print and burn to CD even without doing this bit (no marks for this anyway).