Setting up the situation you described:

AcceptButton's DialogResult = none
CancelButton's DialogResult = none

I also got the same effect.  I trapped the dialog's Closing event and checked out the 
Sender object (the Winform) whose CancelButton's DialogResult was actually set to 
Cancel, even though the design-time property value is "none".  The AcceptButton's 
DialogResult was "none" however.

Also, if I shut the project and VS.NET down, then reopen both, the CancelButton's 
DialogResult is now set to "Cancel", even though I checked it before shutting down 
VS.NET where it had the expected value of "none".

I couldn't determine where the DialogResult property get's changed between design and 
runtime.  Do you get the same behaviour?


mw

> -----Original Message-----
> From: Chris Sells [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 11 June 2002 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Why is CancelButton special?
> 
> 
> If I set the AcceptButton to a button whose DialogResult is 
> set to None,
> pressing that button does not automatically close the form.
> 
> However, if I set the CancelButton to a button whose 
> DialogResult is set
> to None, pressing the button *does* automatically close the form and I
> don't see any way to halt this process, even if I've got an event
> handler for that button. Why is that?
> 
> Chris Sells
> http://www.sellsbrothers.com/
> 
> You can read messages from the DOTNET archive, unsubscribe 
> from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
> 

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to