TextDocumentKeyPressEventsClass.AfterKeyPress Event

Raised after a key press has been handled and the editor has processed the entered text.

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

Syntax

'Declaration
Public Overridable Event AfterKeyPress As _dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler
public virtual event _dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler AfterKeyPress
public:
virtual   event _dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler^ AfterKeyPress {
    void add (_dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler^ value);
    void remove (_dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler^ value);
}
abstract AfterKeyPress : IEvent<_dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler,
    EventArgs>
override AfterKeyPress : IEvent<_dispTextDocumentKeyPressEvents_AfterKeyPressEventHandler,
    EventArgs>
JScript does not support events.

Implements

_dispTextDocumentKeyPressEvents_Event.AfterKeyPress

Remarks

The user may not cancel the key press or its resulting behavior.

Examples

This simple macro example displays a message box every time you type the character, 1, in a text document. Copy this code to the EnvironmentModule in the Macros integrated development environment (IDE) in Visual Studio. For more information about how to write EnvironmentModule macros, see How to: Handle Environment Events in Macros.

Private Sub TextDocumentKeyPressEvents_AfterKeyPress(ByVal Keypress _
 As String, ByVal Selection As EnvDTE.TextSelection, _
 ByVal InStatementCompletion As Boolean) _
 Handles TextDocumentKeyPressEvents.AfterKeyPress
    If (Keypress = "1") Then
        MsgBox("You pressed 1.")
        Return
    End If
End Sub

.NET Framework Security

See Also

Reference

TextDocumentKeyPressEventsClass Class

EnvDTE80 Namespace

TextDocumentKeyPressEvents