Delete a small example of the selected row in DataGridView from ES0en.NET

  • 2020-06-03 06:14:59
  • OfStack


For Each r As DataGridViewRow In DataGridView1.SelectedRows
    If Not r.IsNewRow Then
        DataGridView1.Rows.Remove(r)
    End If
Next

It's an IsNewRow attribute that determines if it's the newly selected row. If it's not, remove!

Related articles: