?
Solved

Use addrange with datagrid item.cell

Posted on 2009-02-13
1
Medium Priority
?
424 Views
Last Modified: 2012-08-13
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

0
Comment
Question by:kdeutsch
1 Comment
 
LVL 16

Accepted Solution

by:
burakiewicz earned 500 total points
ID: 23635642
add range only adds cells, you need to loop through the cells to do that
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question