ListView control allows you to display a list of items with item text and, optionally, an icon to identify the type of item. The ListView control can be used to display information from an application, a database, or a text file. It provides a large number of properties that provide flexibility in appearance and behavior(http://social.msdn.microsoft.com/Search/en-us?query=listview&x=0&y=0).
Well basically,we can change our listview background directly to the property window just select the listview then change the backColor, choose the color you want. But if you want to code it just simply add this line:
ListViewName.BackColor=Color.ColorYouWant
After you populate or retrieve your data put the codes next to it to have an alternate row color. Select the color you want.
Output:
"'Love the Lord your God with all your heart and with all your soul and with all your strength and with all your mind'; and, 'Love your neighbor as yourself.'"
Luke 10:27
Luke 10:27
Thanx for this!
ReplyDeleteCan't seem to raise ColorYouWant on my intellisense :-)
ReplyDeleteThanks
tnx a lot dude
ReplyDeleteThanks for this code.god bless
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteamen
ReplyDeleteYou save my project ... thanks for this ... more power bro ...
ReplyDeleteThis works unless there's an uneven amount of fields, you will miss one if there are try using the following instead :
ReplyDeleteFor i = 0 To listview1.Items.Count - 1
If isEven(i) Then listview1.Items(i).BackColor = Color.White Else listview1.Items(i).BackColor = Color.AliceBlue
Next i
It uses this simple function :
Private Function isEven(numToCheck As Integer) As Boolean
Return (numToCheck And 1) = 0
End Function
lo he probado en load, en drawitem y no funciona, acá no se especifica como usar esto, tengo que crear una nueva clase o que?
ReplyDeletethank you so much!!!!
ReplyDelete