My point is, what you've described is what I would EXPECT
to happen, but that is not happening. The DialogResult IS
being executed. I know, because I set up code in the
CancelButton assigned button such that, I execute the
DialogResult under certain circumstances and sometimes I
don't but the form kept closing regardless. I had to get
to the point of setting the form to perform KeyPreview to
True of the Form, and removing the CancelButton assignment
and to issue the test/closing of form within the KeyPress
event of the Form whenever the user pressed ESCape.
-Lee
>-----Original Message-----
>* "Lee Moody" <(E-Mail Removed)>
scripsit:
>> If you specify a CancelButton property on a form to a
>> specific button, but you specify 'None' as DialogResult
>> for that button, and you show the form using
ShowDialog,
>> pressing ESCape key is causing the DialogResult to fire
>> and closes the form.
>
>The button will be fired, but no 'DialogResult' will be
set. You can
>set the 'DialogResult' in the cancel button's 'Click'
event handler.
>
>--
>Herfried K. Wagner [MVP]
><URL:http://dotnet.mvps.org/>
>.
>
|