Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. images in list view columns

images in list view columns

Scheduled Pinned Locked Moved Visual Basic
sysadminjsontutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moonark
    wrote on last edited by
    #1

    Is there a way to add images into the listview columns kinda like how outlook can display a paperclip instead of text? I have seen that people say that you must tie into the API to do it, but no one provides examples. Does any one know how to do it and is willing to share how they did it? Thanks, - Nick The network is down...let's go get bagels.

    F 1 Reply Last reply
    0
    • M Moonark

      Is there a way to add images into the listview columns kinda like how outlook can display a paperclip instead of text? I have seen that people say that you must tie into the API to do it, but no one provides examples. Does any one know how to do it and is willing to share how they did it? Thanks, - Nick The network is down...let's go get bagels.

      F Offline
      F Offline
      f64
      wrote on last edited by
      #2

      Hi, I don't get what are you trying to do. Adding images to the items or the columns header is very simple to do, no APIs need it. Try something like this

      Dim li As ListItem
      ListView1.ColumnHeaders.Add 1, "col1"
      ListView1.ColumnHeaders.Add 2, "col2", "col2"
      
      'ImageList1 must have at least one image.
      Set ListView1.SmallIcons = ImageList1
      Set ListView1.ColumnHeaderIcons = ImageList1
      Set li = ListView1.ListItems.Add(1, "item1", "", , 1)
      li.ListSubItems.Add 1, "subItem1", "sutItem", 1
      ListView1.ColumnHeaders(1).Icon = 1
      

      I'll suggest you to read the documentation of the control on the MSDN, if after that you still have troubles getting it work as you want, let me know and I'll help you. Fabian

      M 1 Reply Last reply
      0
      • F f64

        Hi, I don't get what are you trying to do. Adding images to the items or the columns header is very simple to do, no APIs need it. Try something like this

        Dim li As ListItem
        ListView1.ColumnHeaders.Add 1, "col1"
        ListView1.ColumnHeaders.Add 2, "col2", "col2"
        
        'ImageList1 must have at least one image.
        Set ListView1.SmallIcons = ImageList1
        Set ListView1.ColumnHeaderIcons = ImageList1
        Set li = ListView1.ListItems.Add(1, "item1", "", , 1)
        li.ListSubItems.Add 1, "subItem1", "sutItem", 1
        ListView1.ColumnHeaders(1).Icon = 1
        

        I'll suggest you to read the documentation of the control on the MSDN, if after that you still have troubles getting it work as you want, let me know and I'll help you. Fabian

        M Offline
        M Offline
        Moonark
        wrote on last edited by
        #3

        It appears that is for VB and not VB.net... .NET does not seem to have ColumnHeaders. ANy thoughts on how to do it in .NET? The network is down...let's go get bagels.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups