Skip to main content

ChangingEventHandler Delegate

Represents a method that will handle the RepositoryItem.EditValueChanging event.

Namespace: DevExpress.XtraEditors.Controls

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

public delegate void ChangingEventHandler(
    object sender,
    ChangingEventArgs e
);

Parameters

Name Type Description
sender Object

The event sender (typically the BaseEdit descendant).

e ChangingEventArgs

A ChangingEventArgs object containing data related to the event.

Remarks

When creating a ChangingEventHandler delegate, you identify the method that will handle the corresponding event. To associate an event with your event handler, add a delegate instance to this event. The event handler is called whenever the event occurs unless you remove the delegate.

The code sample below handles the TextEdit’s EditValueChanged event to accept only numeric values:

textEdit1.EditValueChanging += TextEdit1_EditValueChanging;

void TextEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) {
    int i = 0;
    if (!int.TryParse(e.NewValue.ToString(), out i))
        e.Cancel = true;
}
See Also