0

在我的 DataGridView 中,如果该行是索引 0,它无法隐藏一行。

与货币经理职位相关的行不能隐藏

Dim cm1 As CurrencyManager = CType(BindingContext(dgv.DataSource), CurrencyManager)
cm1.SuspendBinding()
dgv.Rows.Item(0).Visible = False 'this throws the exception
4

1 回答 1

1

根据我的理解,我相信如果这是唯一剩下的行并且它被选中,那么行或单元格必须是可见的。为了解决这个问题,您可以将当前单元格设置为 null 然后SuspendBinding......

这是一个简单的例子......

 Me.dgv.CurrentCell = Nothing
 Me.cm1.SuspendBinding()
 Me.dgv.Rows(index).Visible = False
于 2014-11-12T14:12:10.933 回答