CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2000
    Location
    Philly
    Posts
    59

    ListView & ImageList

    I am trying to perform Exercise 4.1 on Page 186 of Howard Hawhee's MCSD Training. The book doesn't tell you how to do some of the exercises or what the right way to do it is and I'm stuck.
    I can't seem to populate ListView with what is in my ImageList Collection.
    The syntax in the book isn't even the right syntax. It leaves stuff out. Can anyone help me with this. I assume I will have problems adding items based on key, index and icon values in a text box too if the syntax is wrong in the book.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: ListView & ImageList

    If I understand you correct, you need to show the content of an imagelist in a listview, the listview is called LV, and the imagelist is called LI.
    private Sub Form_Load()

    Dim img as ListImage
    Dim sKey as Integer

    for Each img In IL.ListImages
    sKey = img.Index
    LV.ListItems.Add Text:=sKey, Icon:=sKey, SmallIcon:=sKey
    next img

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Apr 2000
    Location
    Philly
    Posts
    59

    Re: ListView & ImageList

    Thanks, I managed to figure it out just before you got back to me. You did it slightly differently though so it's good to know. I am having trouble with displaying path information in a column header of the list view though. Any idea how to do that?


  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: ListView & ImageList

    What exactly do you mean with 'path information'?

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Apr 2000
    Location
    Philly
    Posts
    59

    Re: ListView & ImageList

    Nothing specifically. . . Date Modified, last accessed, file location, etc. I figure if I can get one, I can get the rest. I'm not sure if I would have to use the file system object to do that.
    Also if I wanted to add items to a listview by way way of text box input, would they have to be added to an image list first?
    Thanks for your help.


  6. #6
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: ListView & ImageList

    In order to get that info, you will need to store the filename somewhere. There's no way to determine where the picture came from once it was added to a imagelist. When you add them, you could keep the filename in the tag of the listimage object. This way, you can get the information from the real file.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured