ToolStripDropDownClosingEventArgs ToolStripDropDownClosingEventArgs ToolStripDropDownClosingEventArgs ToolStripDropDownClosingEventArgs Class


Provides data for the Closing event.

public ref class ToolStripDropDownClosingEventArgs : System::ComponentModel::CancelEventArgs
public class ToolStripDropDownClosingEventArgs : System.ComponentModel.CancelEventArgs
type ToolStripDropDownClosingEventArgs = class
    inherit CancelEventArgs
Public Class ToolStripDropDownClosingEventArgs
Inherits CancelEventArgs


The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the Closing event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type ToolStripDropDown named ToolStripDropDown1. Then ensure that the event handler is associated with the Closing event.

private void ToolStripDropDown1_Closing(Object sender, ToolStripDropDownClosingEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason );
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
MessageBox.Show(messageBoxCS.ToString(), "Closing Event" );
Private Sub ToolStripDropDown1_Closing(sender as Object, e as ToolStripDropDownClosingEventArgs) _ 
     Handles ToolStripDropDown1.Closing

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason)
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    MessageBox.Show(messageBoxVB.ToString(),"Closing Event")

End Sub


Use data from the ToolStripDropDownClosingEventArgs class to determine which actions to take when the user closes the drop-down list but before the list is closed.


ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason) ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason) ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason) ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason)

Initializes a new instance of the ToolStripDropDownClosingEventArgs class with the specified reason for closing.


Cancel Cancel Cancel Cancel

Gets or sets a value indicating whether the event should be canceled.

(Inherited from CancelEventArgs)
CloseReason CloseReason CloseReason CloseReason

Gets the reason that the ToolStripDropDown is closing.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also