DataGrid.EndEdit(DataGridColumnStyle, Int32, Boolean) Method

Definition

Requests an end to an edit operation taking place on the DataGrid control.

C#
public bool EndEdit(System.Windows.Forms.DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort);

Parameters

gridColumn
DataGridColumnStyle

The DataGridColumnStyle to cease editing.

rowNumber
Int32

The number of the row to cease editing.

shouldAbort
Boolean

Set to true if the current operation should be stopped.

Returns

true if the editing operation ceases; otherwise, false.

Implements

Examples

The following code example uses the BeginEdit and EndEdit methods to edit a value in a grid displayed by the System.Windows.Forms.DataGrid control.

C#
private void EditValue()
{ 
   int rowtoedit = 1;
   CurrencyManager myCurrencyManager = 
   (CurrencyManager)this.BindingContext[ds.Tables["Suppliers"]];
   myCurrencyManager.Position=rowtoedit;
   DataGridColumnStyle dgc = dataGrid1.TableStyles[0].GridColumnStyles[0];
   dataGrid1.BeginEdit(dgc, rowtoedit);
   // Insert code to edit the value.
   dataGrid1.EndEdit(dgc, rowtoedit, false);
}

Remarks

The EndEdit method returns false if the user is not editing (typing into) a cell.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0

See also