windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-baseview-4a1e2f3b.md
Hides the active editor saving changes made.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public void CloseEditor()
Public Sub CloseEditor
Cell values are edited by editors from the DevExpress Editors Library or their descendants. Unlike the BaseView.HideEditor method which simply closes the active editor, the CloseEditor method also saves the changes made to the edited cell’s content. This method can be useful, for instance, when you need to close the text editor and to save its contents when the input string length reaches a predefined value.
The CloseEditor method is also called automatically when the end-user accepts the edited value.
Note
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the CloseEditor member must not be invoked for these Views. The CloseEditor member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.
Tip
The following in-place editors can post their value to the bound data source immediately after the value changes:
Use the editor’s InplaceModeImmediatePostChanges property to control this behavior. The WindowsFormsSettings.InplaceEditorUpdateMode property allows you to control update behavior globally.
The following code snippets (auto-collected from DevExpress Examples) contain references to the CloseEditor() 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.
winforms-grid-linq-to-sql-master-detail/CS/LinqWithEditing/Form1.cs#L32
ColumnView view = (ColumnView)gridControl1.FocusedView;
view.CloseEditor();
if(view.UpdateCurrentRow()) {
winforms-grid-bind-to-business-objects/CS/GridBoundToRuntimeCreatedData/Form1.cs#L52
//Change a cell value at the data source level to see the INotifyPropertyChanged interface in action.
gridView1.CloseEditor();
Record rec = gridView1.GetFocusedRow() as Record;
winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/CheckMarkSelection.cs#L183
void Invalidate() {
_view.CloseEditor();
_view.BeginUpdate();
winforms-grid-add-new-row-by-typing-in-new-item-row/CS/WindowsApplication3/Main.cs#L37
{
gridView.CloseEditor();
gridView.UpdateCurrentRow();
winforms-grid-linq-to-sql-master-detail/VB/LinqWithEditing/Form1.vb#L34
Dim view As ColumnView = CType(gridControl1.FocusedView, ColumnView)
view.CloseEditor()
If view.UpdateCurrentRow() Then
winforms-grid-bind-to-business-objects/VB/GridBoundToRuntimeCreatedData/Form1.vb#L54
'Change a cell value at the data source level to see the INotifyPropertyChanged interface in action.
gridView1.CloseEditor()
Dim rec As Record = TryCast(gridView1.GetFocusedRow(), Record)
winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/CheckMarkSelection.vb#L212
Private Sub Invalidate()
_view.CloseEditor()
_view.BeginUpdate()
winforms-grid-add-new-row-by-typing-in-new-item-row/VB/WindowsApplication3/Main.vb#L31
If gridView.FocusedRowHandle = GridControl.NewItemRowHandle Then
gridView.CloseEditor()
gridView.UpdateCurrentRow()
See Also