各种常用的WINFORM控件遍历

1:删除空白行

For Each row As DataGridViewRow In Me.dgvBloodSugarInfo.Rows
Dim isEmpty = True
For Each cell As DataGridViewCell In row.Cells
If cell.ColumnIndex > 0 And cell.Value IsNot Nothing Then
isEmpty = False
Exit For
End If
Next
If isEmpty Then
dgvBloodSugarInfo.Rows.Remove(row)
End If
Next

原文地址:https://www.cnblogs.com/leischen/p/2701345.html