BaseEdit.EditValueChanging Event
Fires when the editor’s value is about to change.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
NuGet Package: DevExpress.Win.Navigation
#Declaration
[DXCategory("Events")]
public event ChangingEventHandler EditValueChanging
#Event Data
The EditValueChanging event's data class is ChangingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel |
Gets or sets a value indicating whether the event should be canceled.
Inherited from Cancel |
Is |
For internal use. |
Is |
For internal use. |
Modified |
Gets whether a user changed the value. |
New |
Gets or sets the value which is about to be assigned to the editor. Setting the New |
Old |
Gets the editor’s value. |
#Remarks
The editor’s EditValueChanging event is equivalent to the RepositoryItem.EditValueChanging event, available from the BaseEdit.Properties object.
Note
Do not display modal dialogs or move focus within the Edit
Refer to the RepositoryItem.EditValueChanging event description for additional information.
The code sample below illustrates how to accept only numeric values in a text edit.
textEdit1.EditValueChanging += TextEdit1_EditValueChanging;
private void TextEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
int i = 0;
if (!int.TryParse(e.NewValue.ToString(), out i))
e.Cancel = true;
}