ListView Sample code - error?
There's a bit of sample code in "Beginning Visual Basic .Net Databases" (Chapter 6 - Data Access with ADO.NET) that is supposed to changed the fore and background colour of the listview cell if a certain condition is met. I've stepped through the code and even when it runs, the changed are not taking place on the screen. Can't find this book listed on the wrox Errata / download code sections either...
Lines in question are:
ListView1.Items.Item(currentRow).SubItems.Item(UNI TS_INSTOCK_COLUMN).ForeColor = System.Drawing.Color.White
ListView1.Items.Item(currentRow).SubItems.Item(UNI TS_INSTOCK_COLUMN).BackColor = System.Drawing.Color.DarkRed
UNITS_INSTOCK_COLUMN has been declared as a constant of value 2, referring to the column index. The lines don't cause an error, but have no visible effect on the listview.
Any help appreciated.
|