DataRowCollection.Remove メソッド
アセンブリ: System.Data (system.data.dll 内)


行を削除すると、その行にあるすべてのデータが失われます。DataRow クラスの Delete メソッドを呼び出すと、行に削除マークだけを付けることができます。Remove を呼び出すことは、Delete を呼び出してから AcceptChanges を呼び出すことと同等です。

Remove メソッドを使用して、DataRowCollection オブジェクト内で見つかった行を削除する例を次に示します。この例では、最初に Contains メソッドを使用して、この行コレクションに行が格納されているかどうかを判断します。行が格納されている場合は、Find メソッドを使用して特定の行を検索した後、Remove メソッドを使用してその行を削除します。
Private Sub RemoveFoundRow(ByVal table As DataTable) Dim rowCollection As DataRowCollection = table.Rows ' Test to see if the collection contains the value. If rowCollection.Contains(TextBox1.Text) Then Dim foundRow As DataRow = rowCollection.Find(TextBox1.Text) rowCollection.Remove(foundRow) Console.WriteLine("Row Deleted") Else Console.WriteLine("No such row found.") End If End Sub

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDataRowCollection.Remove メソッドを検索する場合は、下記のリンクをクリックしてください。

- DataRowCollection.Remove メソッドのページへのリンク