This documentation is archived and is not being maintained.

DataRowView.Delete Method

Deletes a row.

[Visual Basic]
Public Sub Delete()
[C#]
public void Delete();
[C++]
public: void Delete();
[JScript]
public function Delete();

Remarks

The row is not permanently deleted until AcceptChanges is invoked on the DataTable that row belongs to.

Example

[Visual Basic, C#, C++] The following example uses the Delete method on a row.

[Visual Basic] 
Private Sub DeleteRow()
    Dim myRow As DataRowView
    Dim myDataView As DataView = CType(dataGrid1.DataSource, DataView)
    myRow = myDataView(dataGrid1.CurrentCell.RowNumber)
    myRow.Delete()
End Sub

[C#] 
private void DeleteRow(){
   DataRowView myRow;
   DataView myDataView = (DataView) dataGrid1.DataSource;
   myRow = myDataView[dataGrid1.CurrentCell.RowNumber];
   myRow.Delete();
}

[C++] 
private:
 void DeleteRow(){
    DataRowView* myRow;
    DataView* myDataView = dynamic_cast<DataView*> (dataGrid1->DataSource);
    myRow = myDataView->Item[dataGrid1->CurrentCell.RowNumber];
    myRow->Delete();
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataRowView Class | DataRowView Members | System.Data Namespace | BeginEdit

Show: