Re: avoid closing Windows form

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Michael Voss (michael.voss_at_lvrREMOVE.deCAPS)
Date: 08/30/04


Date: Mon, 30 Aug 2004 15:40:40 +0200

VMI wrote:
> I overrode WndProc:

You do not have to do that. Just put something like

> > private void frm_audit_Closing(object sender,
> > System.ComponentModel.CancelEventArgs e)
> > {
> > if (_BisSavingData)
> > {
> > // Code that will override the Closing method. I don't want the
form to close

         e.Cancel = true;
         return;

> > }
> > else
> > {
> > // Continue closing the form
> > }
> > }

into your "Form closing" eventhandler.