Redigera

Dela via


DomainUpDown.OnTextBoxKeyPress(Object, KeyPressEventArgs) Method

Definition

Raises the KeyPress event.

protected:
 override void OnTextBoxKeyPress(System::Object ^ source, System::Windows::Forms::KeyPressEventArgs ^ e);
protected override void OnTextBoxKeyPress (object source, System.Windows.Forms.KeyPressEventArgs e);
protected override void OnTextBoxKeyPress (object? source, System.Windows.Forms.KeyPressEventArgs e);
override this.OnTextBoxKeyPress : obj * System.Windows.Forms.KeyPressEventArgs -> unit
Protected Overrides 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

If the ReadOnly property is set to true, the DomainUpDown control chooses the item on the list that begins with the character. If more than one item in the collection starts with the same character, the DomainUpDown control selects the next item that begins with the typed character, starting from the currently selected position.

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' OnTextBoxKeyPress(Object, KeyPressEventArgs) method so that registered delegates receive the event.

Applies to