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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ListView -- how to Bold/Change background color

Status
Not open for further replies.

hwkranger

MIS
Nov 6, 2002
717
US
Hi,

I'm having a little bit of trouble bolding and changing the entire row for an item in a listview. If someone can help me, I would be greatly appreciative.

Code:
Private Function LoadRBData()
'Load Items and bold Aged Items
    Dim rst As New ADODB.RecordSet
    Dim LIX As ListItem
    Dim i As Integer
    Dim bol_bold As Boolean
    
    Call fCheckConnect
    rst.Open fBuildRBSource(Forms!BalanceBranchNum!BRANCH, intRBSortID), dbcnn, adOpenKeyset, adLockReadOnly
        
    Do While Not rst.EOF
        For i = 0 To rst.Fields.Count - 1
           If i = 0 Then
                Set LIX = List.ListItems.Add
                bol_bold = HighlightAgedItem(rst.Fields(i).Value)
                LIX.Text = rst.Fields(i).Value & ""
                LIX.Bold = bol_bold
            
           Else
                LIX.SubItems(i) = rst.Fields(i).Value & ""
                
           End If
        Next i
    rst.MoveNext
    bol_bold = False
    Loop
    rst.Close
    Set rst = Nothing

End Function

I can't seem to find the property to change for highlighting and bolding for the entire row. I found where I can bold the first column, but not the rest

FYI:
fCheckConnect -checks the connection to the server
fBuildRBSource -builds the SQL source for the listbox
HighlightAgedItem -determines whether or not the item needs to be bold (and highlighted)

Thanks for the help!

Randall Vollen
National City Bank Corp.
 
I Found my own solution

Posting:

Code:
                If bol_bold Then
                    LIX.ListSubItems(i).Bold = True
                    LIX.ListSubItems(i).ForeColor = vbRed
                    
                End If

Randall Vollen
National City Bank Corp.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top