0

In my DataGridView, it fails to hide a row, if that row is index 0.

row associated with the currency manager's position cannot be made invisible

Dim cm1 As CurrencyManager = CType(BindingContext(dgv.DataSource), CurrencyManager)
cm1.SuspendBinding()
dgv.Rows.Item(0).Visible = False 'this throws the exception
adam
  • 2,930
  • 7
  • 54
  • 89

1 Answers1

1

From my understanding I believe if that's the only row left and it's selected the row or cell must be visible. To get around this you could possibly setting the current cell to null then SuspendBinding...

Here's a simple example...

 Me.dgv.CurrentCell = Nothing
 Me.cm1.SuspendBinding()
 Me.dgv.Rows(index).Visible = False
Trevor
  • 7,777
  • 6
  • 31
  • 50