Lanc1988 Posted May 10, 2005 Posted May 10, 2005 I have a listview with 200+ items in it and I have a code that changes the font color of certain items.. is there a way I can display in a label the number of items that are a certain font color? Like... If listview.forecolor.red Then... more code Quote
Leaders snarfblam Posted May 10, 2005 Leaders Posted May 10, 2005 Why not declare a variable in which to keep count for each color (provided that there is a reasonably small number of colors), and whenever you change the font color increment and decrement the appropriate variables. Otherwise, you can certainly use the code you provided, but since you have a lot of items, and you must recount the totals on the fly it might cause a small lag. Function MatchCount(ListView As ListView, Color As Color) As Integer Dim Total As Integer For Each Item As ListViewItem In ListView If Item.ForeColor = Color Then _ Total += 1 Next Return Total End Function Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.