SpreadsheetControl.CloseCellEditor(CellEditorEnterValueMode) Method
Closes the cell editor.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
mode | CellEditorEnterValueMode | A CellEditorEnterValueMode enumeration member. |
Returns
Type | Description |
---|---|
Boolean | true if the cell editor is closed successfully; otherwise, false. |
Remarks
Use the CloseCellEditor method to close an open cell editor. To check whether a cell editor is currently active, use the SpreadsheetControl.IsCellEditorActive property. The CloseCellEditor method’s parameter specifies whether to commit an entered value to a cell or roll it back when the editor is closed.
Parameter | Description | Shortcut | Related Events |
---|---|---|---|
Commits an entered value to an active cell. | ENTER | ||
Commits an entered value to all selected cells. | CTRL+ENTER | ||
Commits an entered formula to an active cell or selected cells as an array formula. | CTRL+SHIFT+ENTER | ||
Cancels an entry in the cell editor. | ESC |
You can specify when the SpreadsheetControl.CellValueChanged event should occur after a cell value was edited and committed to a cell: each time, or only if a cell value was changed. To do this, use the SpreadsheetControl.Options.Behavior.CellEditor.CommitMode property (SpreadsheetCellEditorBehaviorOptions.CommitMode).
The following example shows how to use the CloseCellEditor method to commit changes in the active cell editor before the application is closed and save a document.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (spreadsheetControl1.IsCellEditorActive)
spreadsheetControl1.CloseCellEditor(CellEditorEnterValueMode.ActiveCell);
if (spreadsheetControl1.Modified)
spreadsheetControl1.SaveDocument();
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CloseCellEditor(CellEditorEnterValueMode) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.