Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternative row color for ListView

Status
Not open for further replies.

redav

Programmer
Mar 20, 2001
55
0
0
GB
Is it possible to alternate the color of the Back color rows in a listview
 
Here you go!!

Should work, just pass a different color to change

'Function Call

adjustListviewColour lvExceptions, lSelectedItem, vbBlue




Public Function adjustListviewColour(objListview As ListView, lIndex As Long, lColour As Long)

Dim i As Integer
Dim lLvColumnCount As Long


lLvColumnCount = objListview.ColumnHeaders.Count - 1
objListview.ListItems.Item(lIndex).ForeColor = lColour
For i = 1 To lLvColumnCount
Dim lsitem As ObjectobjListview.SelectedItem.ListSubItems.Item(i).ForeColor = lColour
Next

objListview.Refresh

End Function
 
Thanks for your reply.

This changes the fore color which I need any way but do you know if it is possible to have alternative Back color

eg

Light Blue
Blue
Light Blue
Blue
etc
 
Sorry,
Should have taken more care reading the Post.
Im not 100% sure what you mean though,

Do you mean just changing the Forecolor?
Or having dfifferent colours for different columns?

The Latter i dont think you can do..


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top