windowsforms-devexpress-dot-xtraeditors-dot-controls-87d62595.md
Represents a method that will handle the RepositoryItem.EditValueChanging event.
Namespace : DevExpress.XtraEditors.Controls
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public delegate void ChangingEventHandler(
object sender,
ChangingEventArgs e
);
Public Delegate Sub ChangingEventHandler(
sender As Object,
e As ChangingEventArgs
)
| Name | Type | Description |
|---|---|---|
| sender | Object |
The event sender (typically the BaseEdit descendant).
| | e | ChangingEventArgs |
A ChangingEventArgs object containing data related to the event.
|
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;
}
Private textEdit1.EditValueChanging += AddressOf TextEdit1_EditValueChanging
Private Sub TextEdit1_EditValueChanging(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.Controls.ChangingEventArgs)
Dim value = e.NewValue.ToString()
Dim i As Integer = 0
If Not Integer.TryParse(value, i) Then
e.Cancel = True
End If
End Sub
See Also