public class CancelEventArgs : EventArgs
|
A CancelEventArgs provides the CancelEventArgs.Cancel property to indicate whether the event should be canceled.
myDataIsSaved
.// Calls this method from the InitializeComponent() method of your form private void OtherInitialize() { this.Closing += new CancelEventHandler(this.Form1_Cancel); this.myDataIsSaved = new Boolean(); this.myDataIsSaved = true; } protected void Form1_Cancel (Object sender, CancelEventArgs e) { if (!myDataIsSaved) { e.Cancel = true; MessageBox.Show("You must save first."); } else { e.Cancel = false; MessageBox.Show("Goodbye."); } }
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the CancelEventArgs class with the CancelEventArgs.Cancel property set to false. |
ctor #2 | Overloaded:.ctor(bool cancel) Initializes a new instance of the CancelEventArgs class with the CancelEventArgs.Cancel property set to the given value. |
Cancel | Read-write Gets or sets a value indicating whether the event should be canceled. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public CancelEventArgs(); |
public CancelEventArgs( |
cancel
public bool Cancel {get; set;}
|
myDataIsSaved
.// Calls this method from the InitializeComponent() method of your form private void OtherInitialize() { this.Closing += new CancelEventHandler(this.Form1_Cancel); this.myDataIsSaved = new Boolean(); this.myDataIsSaved = true; } protected void Form1_Cancel (Object sender, CancelEventArgs e) { if (!myDataIsSaved) { e.Cancel = true; MessageBox.Show("You must save first."); } else { e.Cancel = false; MessageBox.Show("Goodbye."); } }
~CancelEventArgs(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |