Results 1 to 3 of 3

Thread: Lisview subitems - how do I get images for these??

  1. #1
    Kiweed
    Guest

    Question Lisview subitems - how do I get images for these??

    In VB6 I could easily insert items and sub items into a listview. With the sub items I could also specify an image and all the other attributes.

    VB .NET seems to have 100's of options for all things great and small but I'll be a monkey's uncle if I could find how to set an image for a sub item.

    Although after I insert a sub item I get a sub item back which can be used it does not have the required methods or interface for images. Very frustrating as this was easy in VB6 and we are meant to be moving forward in .NET.

    A bit of my code is :-


    itm = lvSearch.Items.Add("Item text", ImageNo)

    sitm = itm.SubItems.Add("string1")
    sitm = itm.SubItems.Add("string2")


    Any tips welcome!

  2. #2
    New Member
    Join Date
    Mar 2003
    Posts
    14
    Kiweed. Could you please explain to me how you got the image into a subitem in VB6?

    I need this for a listview where the second column (subitem(1))needs to show a performance icon (e.g. red dot, green dot, orange dot) and the third column (subitem(2)) a trend indicator (arrow up, arrow down, arrow right).

  3. #3
    Junior Member Guile.NET's Avatar
    Join Date
    Mar 2003
    Location
    www.voodoochat.com
    Posts
    31
    First you must delegate an Image List to the ListView control.

    VB Code:
    1. ListView1.SmallImageList = ImageList1
    2.         ListView1.Items.Add("My Text", 0)
    The arrow shot by the archer may, or may not, kill a single person. However, stratagems devised by a wise man, can kill even babes in the womb.

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