复制代码 代码如下:
For Each r As DataGridViewRow In DataGridView1.SelectedRows
If Not r.IsNewRow Then
DataGridView1.Rows.Remove(r)
End If
Next
其实就是一个IsNewRow属性,判断是不是为新选中的行,如果不是,remove!
2019-12-14技术教程下载本文ASP.NET,ASP.NET技巧,ASP.NET教程,datagridview,删除,行
复制代码 代码如下:
For Each r As DataGridViewRow In DataGridView1.SelectedRows
If Not r.IsNewRow Then
DataGridView1.Rows.Remove(r)
End If
Next
其实就是一个IsNewRow属性,判断是不是为新选中的行,如果不是,remove!
《VB.NET 中删除DataGridView中所选行的小例子.doc》
下载本文的Word格式文档,以方便收藏与打印。