Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A listview by any other color is still the same listview
Message
De
24/02/2005 00:21:05
 
 
À
23/02/2005 18:12:41
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00989888
Message ID:
00989971
Vues:
50
Glenn,

I could get the rows to be a color, but not the columns. I don't know if that's a bug or if that's how it's supposed to work.

~~Bonnie


>I am having trouble changing the color of cells dynamically in a listview. Here is the code which I thought would work (but it doesn't)
>
>Const product_column As Integer = 0
>Const productname_column As Integer = 1
>Const units_instock_column As Integer = 2
>Const units_onorder_column As Integer = 3
>Const reorderlevel_column As Integer = 4
>Const discontinued_column As Integer = 5
>
>With ListView1.Items
>  .Add(myreader.Item("productid"))
>  curentrow = .Count - 1
>  .Item(curentrow).SubItems.Add(myreader.Item("productname"))
>  .Item(curentrow).SubItems.Add(myreader.Item("unitsinstock"))
>  .Item(curentrow).SubItems.Add(myreader.Item("unitsonorder"))
>  .Item(curentrow).SubItems.Add(myreader.Item("reorderlevel"))
>  .Item(curentrow).SubItems.Add(myreader.Item("discontinued"))
>  If myreader.GetInt16(units_instock_column) <= myreader.GetInt16(reorderlevel_column) And _
>	myreader.GetInt16(units_onorder_column) = 0 And _
>	myreader.GetBoolean(discontinued_column) = False Then
>    .Item(curentrow).SubItems.Item(units_instock_column).ForeColor = Drawing.Color.White
>    .Item(curentrow).SubItems.Item(units_instock_column).BackColor = Drawing.Color.DarkRed
>  Else
>    .Item(curentrow).SubItems.Item(units_instock_column).ForeColor = Drawing.Color.DarkOliveGreen
>    .Item(curentrow).SubItems.Item(units_instock_column).BackColor = Drawing.Color.DarkRed
>  End If
>End With
>
>
>The listbox loads but I see no color changes. Am I color blind?
>
>Thanks
>
>Glenn
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform