Home » Controls » How to Colour a Listview Item or SubItem
How to Colour a Listview Item or SubItem
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 'Controls - How to Colour a Listview Item or SubItem Option Explicit Public Sub ColorListviewRow(ByVal lv As ListView, ByVal RowNbr As Long, ByVal RowColor As OLE_COLOR) Dim itmX As ListItem Dim lvSI As ListSubItem Dim intIndex As Integer On Error GoTo ColorListviewRow_Error Set itmX = lv.ListItems(RowNbr) itmX.ForeColor = RowColor For intIndex = 1 To lv.ColumnHeaders.Count - 1 Set lvSI = itmX.ListSubItems(intIndex) lvSI.ForeColor = RowColor Next intIndex Set itmX = Nothing Set lvSI = Nothing ExitHere: On Error GoTo 0 Exit Sub ColorListviewRow_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ColorListviewRow of Form Form1" End Sub |
Related posts:
- How to scroll for selected ListView item
- Duplicate Listview Item Remover
- How to select entire Row in List View
- How to identify the selected items in listview
- How to kill duplicates in Listview control
- How to Read a file and add each line to an array of strings
- How to write a string array to a text file
- How to check whether an item exists in a collection
- How to Draw 3D text on form
- How to Retrieve the File Name from a Path
Enjoy this article?
Filed under: Controls
Leave a comment
Sponsors
Link Back to us
Donations
If you are benefited from this site, please donate a small contribution to us. It will help to maintain this site better.