DataGrid.EndEdit(DataGridColumnStyle, Int32, Boolean) メソッド

定義

DataGrid コントロールで実行している編集操作の終了を要求します。Requests an end to an edit operation taking place on the DataGrid control.

public:
 virtual bool EndEdit(System::Windows::Forms::DataGridColumnStyle ^ gridColumn, int rowNumber, bool shouldAbort);
public bool EndEdit (System.Windows.Forms.DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort);
abstract member EndEdit : System.Windows.Forms.DataGridColumnStyle * int * bool -> bool
override this.EndEdit : System.Windows.Forms.DataGridColumnStyle * int * bool -> bool
Public Function EndEdit (gridColumn As DataGridColumnStyle, rowNumber As Integer, shouldAbort As Boolean) As Boolean

パラメーター

gridColumn
DataGridColumnStyle

編集を中断する DataGridColumnStyleThe DataGridColumnStyle to cease editing.

rowNumber
Int32

編集を中断する行の番号。The number of the row to cease editing.

shouldAbort
Boolean

現在の操作を中断する必要がある場合は、true に設定します。Set to true if the current operation should be stopped.

戻り値

Boolean

編集操作を終了する場合は true。それ以外の場合は falsetrue if the editing operation ceases; otherwise, false.

実装

次のコード例では、 BeginEdit メソッドとメソッドを使用し EndEdit て、コントロールによって表示されるグリッド内の値を編集し System.Windows.Forms.DataGrid ます。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.

void EditValue()
{
   int rowtoedit = 1;
   CurrencyManager^ myCurrencyManager = dynamic_cast<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.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 Sub EditValue()
   Dim rowtoedit As Integer = 1
   Dim myCurrencyManager As CurrencyManager = _
   CType(Me.BindingContext(ds.Tables("Suppliers")), CurrencyManager)
   myCurrencyManager.Position = rowtoedit
   Dim dgc As DataGridColumnStyle = _
   dataGrid1.TableStyles(0).GridColumnStyles(0)
   dataGrid1.BeginEdit(dgc, rowtoedit)
   ' Insert code to edit the value.
   dataGrid1.EndEdit(dgc, rowtoedit, False)
End Sub 

注釈

EndEdit false ユーザーがセルを編集 (入力) していない場合、メソッドはを返します。The EndEdit method returns false if the user is not editing (typing into) a cell.

適用対象

こちらもご覧ください