[RESOLVED] Change Color of ListView Item
I am trying to either change the text or preferably the background color of a listview item if it is checked and a button is pressed.
I looked at a few older ways of doing it but it doesn't work anymore
I'm not really sure about how to do this.
Code:
Private Sub RemoveSelectedAddressesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles RemoveSelectedAddressesToolStripMenuItem.Click
'0.0 Exception Handler
Try
For Each i As ListViewItem In lstvwEmails.CheckedItems
'get the index of the item, remove in array
EmailArray.RemoveAt(lstvwEmails.Items.IndexOf(i))
'Change color of item so they know it was removed
???????????????????????????????????????????????????
Next()
Catch ex As Exception
MessageBox.Show("Error occured in Form: Main. Function: RemoveSelectedAddressesToolStripMenuItem_Click. Error: " & ex.Message, "Error")
End Try
End Sub
Re: Change Color of ListView Item
What is the first member that comes up when you place the cursor inside the loop and type:
Re: Change Color of ListView Item
you must look for the ItemDraw Event of the listview
Re: Change Color of ListView Item
Quote:
Originally Posted by
ForumAccount
What is the first member that comes up when you place the cursor inside the loop and type:
woooooooooow, lol thanks! Sorry, I was thinking it had to be like
ListView.Items(i).BackgroundColor = blah
Re: Change Color of ListView Item
Technically you could do it that way as well. It would just be BackColor instead of BackgroundColor.