Use addrange with datagrid item.cell

What I have is a datagrid with 7 columns in it.  Currently I have it so that if there is a no in cell 7 it colors the name red.  What I really need is a way to call out columns 2 -7 if there are any no's it colors the name red.  I have tried using the following with no luck keeps giving me blue underlines ander the range numbers.  How can I call our columns 2 - 7 and color name red if they have a no.

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
            If e.Item.Cells.AddRange(2 - 7).Text = "No" Then
                e.Item.Cells(0).BackColor = System.Drawing.Color.Tomato
            End If
            If e.Item.Cells(7).Text = "Yes" Then
                e.Item.Cells(0).BackColor = System.Drawing.Color.Green
            End If
        End If

Open in new window

Who is Participating?
burakiewiczConnect With a Mentor Commented:
add range only adds cells, you need to loop through the cells to do that
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.