Advertisements

Your first step should be to remove your check for is numeric and that the
text is equal to 945370550 to see if every cell is then colored. That will
let you know if the problem is that the cell isn't being colored or if one
of your checks is not written correctly.

"Out of chaos comes order."
Nietzsche
"serge calderara" <> wrote in
message news:...
> Dear all,
>
> What is the way to check the value of a particular item in a particular
> cell
> and then set its forground property in red in case of a certain value ??
>
> I have done the following but do dot work :
>
> ============================
> Select Case e.Item.ItemType
> Case ListItemType.Item
>
> If IsNumeric(e.Item.Cells(e.Item.ItemIndex).Text) Then
> If CInt(e.Item.Cells(e.Item.ItemIndex).Text) =
> 945370550
> Then
> e.Item.BackColor = Color.Red
> e.Item.ForeColor = Color.White
>
> End If
> End If
> End Select
>
> what dis I miss ?
>
> thnaks for your help
> regards
> serge

Advertisements

e.Item.ItemIndex is the index of the item in the datagrid's Items
collection. It has nothing to do with Cells collection. To get to a cell,
you need to specify it's column number, 0-based. For example,
e.Item.Cells(3) points to the 4th cell in the row.

Eliyahu

"serge calderara" <> wrote in
message news:...
> Dear all,
>
> What is the way to check the value of a particular item in a particular
> cell
> and then set its forground property in red in case of a certain value ??
>
> I have done the following but do dot work :
>
> ============================
> Select Case e.Item.ItemType
> Case ListItemType.Item
>
> If IsNumeric(e.Item.Cells(e.Item.ItemIndex).Text) Then
> If CInt(e.Item.Cells(e.Item.ItemIndex).Text) =
> 945370550
> Then
> e.Item.BackColor = Color.Red
> e.Item.ForeColor = Color.White
>
> End If
> End If
> End Select
>
> what dis I miss ?
>
> thnaks for your help
> regards
> serge

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!