I have code in a class module that loads a listview control from a recordset. At the line item I want to add an image of an envelope if the person has an email address within the recordset. I've tried declaring a ImageList object within the method and setting it equal to the form's imagelist but it returns the error: Imagelist must be initialized before it can be used.

This is how I am declaring it:

Dim ImageLst As ImageList

' On Error GoTo PROC_ERR

Set ImageLst = frmChooseOU.ImageList1

This is how I'm trying to use it:

If Not IsMissing(vMailColumn) Then

If Not IsNull(li.SubItems(vMailColumn)) Then

li.SmallIcon = ImageLst.ListImages.Item(4)

End If

End If

Before I spend a whole lot of time on this I wanted to see if anyone knew if this was even possible.


This worked fine once I set the LvwIn.SmallIcons = ImageLst