Link to home
Start Free TrialLog in
Avatar of mlittler
mlittler

asked on

highlight new items in listbox

Is it possible to set the text format to bold for individual rows in a list box?

I am trying to recreate something like Outlook in an Access form, and so I want new entries in the list box to appear in bold, until they are clicked on (like new emails are in bold in Outlook). Is this possible?
Avatar of rockiroads
rockiroads
Flag of United States of America image

Not sure if that is possible, because I think the font properties apply to all entries in a listbox

Have you thought of using the FlexGrid, its more powerful because of its formatting features
or maybe the listview control (reference "Microsoft Widows Common Controls" )
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try modifying the code above to find the selected item and unbold it.

    For Each li In lstView.ListItems
        If li.Text = "Row2" Then
        li.Bold = False
    Next


            li.ForeColor = vbRed
            li.Bold = True
        End If
    Next
try modifying the code above to find the selected item and unbold it.

    For Each li In lstView.ListItems
        If li.Text = "Row2" Then
        li.Bold = False
    Next


            li.ForeColor = vbRed
            li.Bold = True
        End If
    Next
oops, that was a mispost.

   For Each li In lstView.ListItems
        If li.Text = Me.lstView.ItemData(Me.lstView.Selected(x)) Then
           li.Bold = False
           Exit For
        End If
    Next

I don't know (or even think) that this will work because I used some properties/collections that I don't think that are for list view, but I'm not sure.

Andrew
I created a sample form and put that code in, it seems to work for me