Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A listview by any other color is still the same listview
Message
From
23/02/2005 18:12:41
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
A listview by any other color is still the same listview
Miscellaneous
Thread ID:
00989888
Message ID:
00989888
Views:
70
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
Next
Reply
Map
View

Click here to load this message in the networking platform