Export (0) Print
Expand All
Expand Minimize

DataGrid.EndEdit Method

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

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public bool EndEdit (
	DataGridColumnStyle gridColumn,
	int rowNumber,
	bool shouldAbort
)
public final boolean EndEdit (
	DataGridColumnStyle gridColumn, 
	int rowNumber, 
	boolean shouldAbort
)
public final function EndEdit (
	gridColumn : DataGridColumnStyle, 
	rowNumber : int, 
	shouldAbort : boolean
) : boolean

Parameters

gridColumn

The DataGridColumnStyle to cease editing.

rowNumber

The number of the row to cease editing.

shouldAbort

Set to true if the current operation should be stopped.

Return Value

true if the editing operation ceases; otherwise, false.

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

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.

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);
}

private void EditValue()
{
    int rowtoedit = 1;
    CurrencyManager myCurrencyManager = 
        (CurrencyManager)(this.get_BindingContext().
        get_Item(ds.get_Tables().get_Item("Suppliers")));
    myCurrencyManager.set_Position(rowtoedit);
    DataGridColumnStyle dgc = dataGrid1.get_TableStyles().
        get_Item(0).get_GridColumnStyles().get_Item(0);
    dataGrid1.BeginEdit(dgc, rowtoedit);
    // Insert code to edit the value.
    dataGrid1.EndEdit(dgc, rowtoedit, false);
} //EditValue

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft