Results 1 to 2 of 2

Thread: [RESOLVED] ImageList on ListView

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Resolved [RESOLVED] ImageList on ListView

    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?

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: ImageList on ListView

    Quote 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:
    1. With ListView1
    2.         .ColumnHeaderIcons = Me.ImageList1 'Icons for the Columnheaders
    3.         .SmallIcons = Me.ImageList2 'Small Icons
    4.         .Icons = Me.ImageList3 ' Large Icons
    5.    End With
    Last edited by Mark Gambo; Sep 28th, 2005 at 07:35 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width