System.Windows.Forms.DataGridView.CommitEdit Method

Commits changes in the current cell to the data cache without ending edit mode.

Syntax

public bool CommitEdit (DataGridViewDataErrorContexts context)

Parameters

context
A bitwise combination of System.Windows.Forms.DataGridViewDataErrorContexts values that specifies the context in which an error can occur.

Returns

true if the changes were committed; otherwise false.

Remarks

This method attempts to convert the formatted, user-specified value to the underlying cell data type. To do this, it raises the DataGridView.CellParsing event, which you can handle to customize the type conversion. Otherwise, default type converters are used. Conversion errors may result in an exception if the DataGridView.DataError event is not handled to prevent it. If the value is successfully converted, it is committed to the data store, raising the DataGridView.CellValuePushed event for non-data-bound cells when the DataGridView.VirtualMode property value is true. If the value is successfully committed, the DataGridView.CellValueChanged event occurs.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0