Usually a form can be stopped from closing by handling the event which occurs when cancel button is clicked . This is possible in VB . I presume it should be possible in .Net You got to set Cancel = -1 in the code if I remember correctly in VB.
--- Ian Griffiths <[EMAIL PROTECTED]> wrote: > As far as I can tell the purpose of having a > CancelButton is to close the > form for you automatically whatever. If you don't > want this behaviour don't > assign a CancelButton! > > By the way having the DialogResult as None is > handled as a special case. If > you set the DialogResult to be anything else then > Windows Forms will return > whatever you specify as the DialogResult. But if > your CancelButton > specifies None it returns Cancel anyway! (But I > think it always closes the > form.) > > Why do you want something to be a CancelButton but > not have it close the > form? Is there something else that CancelButton > does for you? > > -- > Ian Griffiths > DevelopMentor > > ----- Original Message ----- > From: "Chris Sells" <[EMAIL PROTECTED]> > > > > 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? > > You can read messages from the DOTNET archive, > unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.