
Originally Posted by
Newtester
Ijust copied some code that is working fine into my application but getting errors in my app. It is a listview and when a user clicks on a column header that it sorts the list and also shows an image on that column header. It works fine in the sample code but when I copied it in my app I am getting this error:
ImageList must be initialized before it can be used.
What am Idoing wrong?
You are correct you have to initialized the image lists before using them. You can do it two ways. First by using the listview property (Right Mouse Click on listview and select Properties) or how I do it:
VB Code:
With ListView1
.ColumnHeaderIcons = Me.ImageList1 'Icons for the Columnheaders
.SmallIcons = Me.ImageList2 'Small Icons
.Icons = Me.ImageList3 ' Large Icons
End With