DataGridView.EndEdit 方法

定义

提交对当前单元格进行的编辑并结束编辑操作。Commits and ends the edit operation on the current cell.

重载

EndEdit()

使用默认错误上下文提交对当前单元格进行的编辑并结束编辑操作。Commits and ends the edit operation on the current cell using the default error context.

EndEdit(DataGridViewDataErrorContexts)

使用指定的错误上下文提交对当前单元格进行的编辑并结束编辑操作。Commits and ends the edit operation on the current cell using the specified error context.

EndEdit()

使用默认错误上下文提交对当前单元格进行的编辑并结束编辑操作。Commits and ends the edit operation on the current cell using the default error context.

public:
 bool EndEdit();
public bool EndEdit ();
member this.EndEdit : unit -> bool
Public Function EndEdit () As Boolean

返回

如果编辑操作已提交并结束,则为 true;否则为 falsetrue if the edit operation is committed and ended; otherwise, false.

异常

无法提交单元格值,且没有 DataError 事件的处理程序或处理程序已将 ThrowException 属性设置为 trueThe cell value could not be committed and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

注解

此方法调用 @no__t 0 重载,并传入 @no__t 的按位组合和 @no__t 2 值。This method calls the EndEdit overload, passing in a bitwise combination of the Parsing and Commit values.

此方法引发 CellEndEdit 事件。This method raises the CellEndEdit event.

如果错误未处理 DataError 事件,则此方法可能会导致异常。This method may result in an exception if errors are not handled with the DataError event.

另请参阅

EndEdit(DataGridViewDataErrorContexts)

使用指定的错误上下文提交对当前单元格进行的编辑并结束编辑操作。Commits and ends the edit operation on the current cell using the specified error context.

public:
 bool EndEdit(System::Windows::Forms::DataGridViewDataErrorContexts context);
public bool EndEdit (System.Windows.Forms.DataGridViewDataErrorContexts context);
member this.EndEdit : System.Windows.Forms.DataGridViewDataErrorContexts -> bool
Public Function EndEdit (context As DataGridViewDataErrorContexts) As Boolean

参数

context
DataGridViewDataErrorContexts

DataGridViewDataErrorContexts 值的按位组合,指定可能出错的上下文。A bitwise combination of DataGridViewDataErrorContexts values that specifies the context in which an error can occur.

返回

如果编辑操作已提交并结束,则为 true;否则为 falsetrue if the edit operation is committed and ended; otherwise, false.

异常

无法提交单元格值,且没有 DataError 事件的处理程序或处理程序已将 ThrowException 属性设置为 trueThe cell value could not be committed and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

注解

此方法引发 CellEndEdit 事件。This method raises the CellEndEdit event.

如果错误未处理 DataError 事件,则此方法可能会导致异常。This method may result in an exception if errors are not handled with the DataError event.

另请参阅

适用于