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
23/02/2005 18:12:41
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
A listview by any other color is still the same listview
Divers
Thread ID:
00989888
Message ID:
00989888
Vues:
69
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform