Question Listview items text

bjwade62

Well-known member
Joined
May 25, 2006
Messages
50
Programming Experience
3-5
I'm having trouble getting the text value of each listview items. Sounds easy but I'm having trouble. Any help out there?

Thanks
 
If you're interested in only the selected items:
ListView1.SelectedItems(0).Text

or any item:
ListView1.Items(0).Text

Also, that (0) part can be a counter variable if you want to loop through all the items/selecteditems

it all depends on how you're getting at the data (be it single item/selected item or a loop through all or part)
 
That worked thanks. Now the problem I'm having is that in the loop I'm changing the forecolor of items that don't equal a certain value.

The problem is they don't change color unless I click on my desktop and then click on my app's window. Then the color changes. I don't get it.

Thanks
 
Strange, I use VS2008 though and get immediate response, but you could try forcing a repaint of invalidated areas by calling Update for the ListView. Or Refresh to invalidate and update.
 
Back
Top