Rediger

Del via


UpDownBase.OnTextBoxKeyPress(Object, KeyPressEventArgs) Method

Definition

Raises the KeyPress event.

protected:
 virtual void OnTextBoxKeyPress(System::Object ^ source, System::Windows::Forms::KeyPressEventArgs ^ e);
protected virtual void OnTextBoxKeyPress (object source, System.Windows.Forms.KeyPressEventArgs e);
protected virtual void OnTextBoxKeyPress (object? source, System.Windows.Forms.KeyPressEventArgs e);
abstract member OnTextBoxKeyPress : obj * System.Windows.Forms.KeyPressEventArgs -> unit
override this.OnTextBoxKeyPress : obj * System.Windows.Forms.KeyPressEventArgs -> unit
Protected Overridable Sub OnTextBoxKeyPress (source As Object, e As KeyPressEventArgs)

Parameters

source
Object

The source of the event.

e
KeyPressEventArgs

A KeyPressEventArgs that contains the event data.

Remarks

Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.

The OnTextBoxKeyPress method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors

When overriding OnTextBoxKeyPress(Object, KeyPressEventArgs) in a derived class, be sure to call the base class's OnTextBoxKeyPress(Object, KeyPressEventArgs) method so that registered delegates receive the event.

Applies to

See also