DataView.Delete(Int32) 方法

定義

刪除指定索引處的數據列。

public:
 void Delete(int index);
public void Delete(int index);
member this.Delete : int -> unit
Public Sub Delete (index As Integer)

參數

index
Int32

要刪除之列的索引。

範例

以下範例使用 Delete 刪除一列的方法。

Private Sub DeleteRow(view As DataView, val As String)
    ' Find the given value in the DataView and delete the row.
    Dim i As Integer = view.Find(val)

    If i = -1 Then
        ' The value wasn'table found
        Console.WriteLine("Value not found in primary key column")
        Exit Sub
    Else
        view.Delete(i)
    End If
End Sub

備註

刪除 後 DataRow,其狀態會變為 DataViewRowState.Deleted。 你可以透過呼叫 RejectChangesDataTable. 來回滾刪除。

適用於

另請參閱