DataGridTextBoxColumn.EndEdit Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Ends an edit operation on the DataGridColumnStyle.
protected:
void EndEdit();
protected void EndEdit ();
member this.EndEdit : unit -> unit
Protected Sub EndEdit ()
Examples
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
Remarks
To edit the value of a cell, call the DataRow object's BeginEdit before changing the value. You must invoke the AcceptChanges method on both the DataRow and DataTable objects before the change is committed.
Applies to
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.