|
-
Nov 19th, 2009, 06:11 AM
#4
Thread Starter
Fanatic Member
Re: Change Listview Backcolor with a condition
 Originally Posted by jmcilhinney
First up, the default value for the UseItemStyleForSubItems property of a ListViewItem is True so, unless you want to use different Fonts or ForeColors for the subitems, you only have to set the item BackColor, not all the subitems too.
Secondly, if you test for greater than 6000 first then everything greater than 8000 and whatever else (you have 6000 twice in your post above) will match too, which you don't want.
vb Code:
Dim backColor As Color Select Case CInt(lvItem.SubItems(4)) Case Is > 9000 backColor = Color.Green Case Is > 8000 backColor = Color.Pink Case Is > 6000 backColor = Color.CornflowerBlue Case Else backColor = SystemColors.Window End Select lvItem.BackColor = backColor
Thanks John ,
actually there is bug
i modded that code but
Code:
Select Case CInt(item1.SubItems(4).Text)
Case Is > 9000
backColor = Color.Green
Case Is > 8000
backColor = Color.Pink
Case Is > 6000
backColor = Color.Green
Case Else
backColor = SystemColors.CornflowerBlue
End Select
ListView3.BackColor = backColor
actually i'am show listview rows via loop
when i added that code i get the the backcolor changed on the Listview itself
but i'am trying to change backcolor of current row in the listview
@weirddemon,
i do have only 1 Listview
weirddemonz
edit : Fixed now all work Thanks John & weirddemon
Last edited by killer7k; Nov 19th, 2009 at 07:04 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|