[VB.NET] 迴圈刪除DataGridView資料

  • 323
  • 0
  • 2022-02-14

  從尾至頭移除DataGridView中的每一個Row:


For int_Index As Integer = DataGridView1.RowCount - 1 To 0 Step -1

    If DataGridView1.Rows(int_Index ).Cells(0).Value = "" Then

        DataGridView1.Rows.RemoveAt(int_Index )

    End If

Next int_Index