Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting form shutdown
Message
De
23/08/2005 19:33:34
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/08/2005 11:18:08
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01042947
Message ID:
01043118
Vues:
9
>>With the Closing() event.
>
>You mean the Closed() event.

You can use either. If you want to avoid form closing, Closed() is too late.

Here is an example that conditionally avoids closing:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
  e.Cancel = (MessageBox.Show("Some question", "Message",
    MessageBoxButtons.OKCancel,  MessageBoxIcon.Information )).ToString()
    != "OK";
}
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform