Share via


CommandEventsClass.BeforeExecute Event

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Occurs before a command executes.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Public Overridable Event BeforeExecute As _dispCommandEvents_BeforeExecuteEventHandler
'Usage
Dim instance As CommandEventsClass 
Dim handler As _dispCommandEvents_BeforeExecuteEventHandler 

AddHandler instance.BeforeExecute, handler
public virtual event _dispCommandEvents_BeforeExecuteEventHandler BeforeExecute
public:
virtual   event _dispCommandEvents_BeforeExecuteEventHandler^ BeforeExecute {
    void add (_dispCommandEvents_BeforeExecuteEventHandler^ value);
    void remove (_dispCommandEvents_BeforeExecuteEventHandler^ value);
}
JScript does not support events.

Implements

_dispCommandEvents_Event.BeforeExecute

Remarks

Before executing the function that is declared to be the implementation of a command, the BeforeExecute event occurs. Any number of listeners may be registered for the event. Each listener executes when the event occurs.

If a listener claims it has implemented the command, no other listener or function should try to implement the command. A listener claims to have implemented the command by returning true for the handled parameter. If a listener only performs some extra function that was not supposed to be performed, such as making a log entry that the command fired or perhaps incrementing a counter displayed somewhere, then the listener returns false for the handled parameter.

Use CommandEvents.BeforeExecute.

Examples

Public Sub CommandEvents_BeforeExecute(ByVal Guid As String, ByVal ID As Integer, ByVal CustomIn As Object, ByVal CustomOut As Object, ByRef CancelDefault As Boolean) Handles CommandEvents.BeforeExecute
   MsgBox("test")
End Sub

.NET Framework Security

See Also

Reference

CommandEventsClass Class

CommandEventsClass Members

EnvDTE Namespace