VB.NET 中删除DataGridView中所选行的小例子
(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )
复制代码 代码如下:
For Each r As DataGridViewRow In DataGridView1.SelectedRows
If Not r.IsNewRow Then
DataGridView1.Rows.Remove(r)
End If
Next
其实就是一个IsNewRow属性,判断是不是为新选中的行,如果不是,remove!
For Each r As DataGridViewRow In DataGridView1.SelectedRows
If Not r.IsNewRow Then
DataGridView1.Rows.Remove(r)
End If
Next
其实就是一个IsNewRow属性,判断是不是为新选中的行,如果不是,remove!
下一篇:.net 页面指定区域打印的方法