DataGridTextBoxColumn.EndEdit DataGridTextBoxColumn.EndEdit DataGridTextBoxColumn.EndEdit DataGridTextBoxColumn.EndEdit Method

定義

DataGridColumnStyle の編集操作を終了します。Ends an edit operation on the DataGridColumnStyle.

protected:
 void EndEdit();
protected void EndEdit ();
member this.EndEdit : unit -> unit
Protected Sub EndEdit ()

次の例ではEndEdit 、列の値を編集する前にメソッドを呼び出します。The following example invokes the EndEdit method before editing a column's value.

Private Sub EditGrid()
    ' Get the current DataGridColumnStyle through the CurrentCell.
    Dim dgCol As DataGridColumnStyle
    Dim colNum As Integer
    Dim rowNum As Integer
    Dim dataTable1 As DataTable
    
    With dataGrid1.CurrentCell
        colNum = .ColumnNumber
        rowNum = .RowNumber    
    End With
    dgCol = dataGrid1.TableStyles(0).GridColumnStyles(ColNum)
    ' Invoke the BeginEdit method.
     
    If dataGrid1.BeginEdit(dgCol, rowNum) Then
        ' Edit row value.
        dataTable1 = dataSet1.Tables(dataGrid1.DataMember)
        Dim myRow As DataRow
        myRow = dataTable1.Rows(rowNum)
        myRow.BeginEdit
        myRow(colNum) = edit1.Text
        myRow.AcceptChanges
        dataTable1.AcceptChanges
        Console.WriteLine("Edited?")
        dataGrid1.EndEdit(dgcol, rowNum, False)
    Else
        Console.WriteLine("BeginEdit failed.")
    End If
End Sub

注釈

セルの値を編集するには、値DataRowを変更BeginEditする前にオブジェクトのを呼び出します。To edit the value of a cell, call the DataRow object's BeginEdit before changing the value. 変更がコミットさAcceptChangesれる前に、 DataRowオブジェクトDataTableとオブジェクトの両方でメソッドを呼び出す必要があります。You must invoke the AcceptChanges method on both the DataRow and DataTable objects before the change is committed.

適用対象