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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應