troubleshooting Question

Help with hiding rows in DataGridView

Avatar of vcharles
vcharles asked on
.NET ProgrammingVisual Basic.NET
6 Comments1 Solution424 ViewsLast Modified:

I'm trying to hide certain rows in DataGridView depending on items selected on a Combobox, when select the second row of the Combox a second time, I receive the following error:

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

On line:

Me.DataGridView5.Rows(i).Visible = False

  Dim i As Integer
        If C1AEDL.SelectedIndex = 0 Then
            For i = 0 To 2
                Me.DataGridView5.Rows(i).Visible = False
        End If
        If C1AEDL.SelectedIndex = 1 Then
            For i = 3 To 5
                Me.DataGridView5.Rows(i).Visible = False
        End If

How do I fix this problem? Don't understand why the error does not occur the first time it was selected.


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros