SpreadsheetControl.CellValueChanged Event
Occurs after the cell content has been changed via the SpreadsheetControl UI.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v18.2.dll
Declaration
Event Data
The CellValueChanged event's data class is SpreadsheetCellEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Action | Identifies an action which caused a change of the cell value. |
Cell | Gets the cell for which the event is fired. Inherited from SpreadsheetCellEventArgsBase. |
ColumnIndex | Gets the index of the column that contains the cell. Inherited from SpreadsheetCellEventArgsBase. |
Formula | Gets the formula that is currently contained in the cell. Inherited from SpreadsheetCellEventArgsBase. |
FormulaInvariant | Gets the formula in the invariant culture that is currently contained in the cell. Inherited from SpreadsheetCellEventArgsBase. |
OldFormula | Gets the cell’s previous formula. |
OldFormulaInvariant | Gets the cell’s previous formula in the invariant culture. |
OldValue | Gets the cell’s previous value. |
RowIndex | Gets the index of the row that contains the cell. Inherited from SpreadsheetCellEventArgsBase. |
SheetName | Gets the name of the worksheet that contains the cell. Inherited from SpreadsheetCellEventArgsBase. |
Value | Gets the value currently contained in the cell. Inherited from SpreadsheetCellEventArgsBase. |
Worksheet | Gets the worksheet that contains the cell. Inherited from SpreadsheetCellEventArgsBase. |
Remarks
The CellValueChanged event fires after the cell content has been changed as a result of end-user interaction. The list below provides the possible reasons for this event being raised:
The cell content has been modified via the cell in-place editor or formula bar. The cell editor is closed and the entered value is committed to an active cell or selected cells when an end-user clicks outside the edited cell, or presses ENTER, CTRL+ENTER or CTRL+SHIFT+ENTER, or the SpreadsheetControl.CloseCellEditor method is called with a passed parameter value other than CellEditorEnterValueMode.Cancel.
You can specify when the CellValueChanged event should be raised after a cell value has been edited via the cell editor and committed to a cell: each time, or only if a cell value has been changed. To do this, use the SpreadsheetCellEditorBehaviorOptions.CommitMode property, accessible via the SpreadsheetControl.Options.Behavior.CellEditor.CommitMode notation.
Before the cell editor is opened, closed or canceled, the SpreadsheetControl.CellBeginEdit, SpreadsheetControl.CellEndEdit or SpreadsheetControl.CellCancelEdit event occurs, respectively. You can handle these events to perform any actions before an end-user activates the cell editor, commits or rolls back the entered value. For example, handle the SpreadsheetControl.CellBeginEdit event to prevent cell values from being modified via the cell editor, or handle the SpreadsheetControl.CellEndEdit event to validate cell values entered by end-users.
- The cell content has been removed when an end-user pressed DELETE.
- A new hyperlink has been added to a cell via the Insert Hyperlink dialog, or an existing hyperlink has been modified via the Edit Hyperlink dialog.
Note
By default, the CellValueChanged event does not occur when changing cell content via code. However, this event will also be triggered by changes made via an API if you set the WorkbookEventOptions.RaiseOnModificationsViaAPI property (accessible via the SpreadsheetControl.Options.Events.RaiseOnModificationsViaAPI notation) to true.
The CellValueChanged event does not occur when a cell value is changed after a formula has been recalculated, even if the recalculation has been caused by the SpreadsheetControl UI.