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. how to Add ListviewItem in ListViewGroup ?

how to Add ListviewItem in ListViewGroup ?

Scheduled Pinned Locked Moved Visual Basic
comtutorialquestion
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.
  • R Offline
    R Offline
    Rizwan Bashir
    wrote on last edited by
    #1

    Hi I have done this in my previous project successfully. Now I am doing this again on my current project and it does not display groups. although ShowGroups property is set to true with view property = details. The code is Dim lg As System.Windows.Forms.ListViewGroup = lvAll.Groups.Add("abc", "abc") Dim lstSC As New ListViewItem("xyz") lstSC.SubItems.Add("xyz1") lstSC.Group = lg lvAll.Items.Add(lstSC) ' where lvAll is listview name I copy pasted the listview control from my previous project incase I am missing any property but it does not work. Any Suggestions would be highly appreciated. Regards

    Rizwan Bashir ALM Soft[^]

    D 1 Reply Last reply
    0
    • R Rizwan Bashir

      Hi I have done this in my previous project successfully. Now I am doing this again on my current project and it does not display groups. although ShowGroups property is set to true with view property = details. The code is Dim lg As System.Windows.Forms.ListViewGroup = lvAll.Groups.Add("abc", "abc") Dim lstSC As New ListViewItem("xyz") lstSC.SubItems.Add("xyz1") lstSC.Group = lg lvAll.Items.Add(lstSC) ' where lvAll is listview name I copy pasted the listview control from my previous project incase I am missing any property but it does not work. Any Suggestions would be highly appreciated. Regards

      Rizwan Bashir ALM Soft[^]

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      ListViewGroups only work on XP or above. They don't work on Windows 2000 and below. In addition, you're application must have previously called Application.EnableVisalStyles() and the ListView's View property must be set to anything other than View.List in order for groups to work.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        ListViewGroups only work on XP or above. They don't work on Windows 2000 and below. In addition, you're application must have previously called Application.EnableVisalStyles() and the ListView's View property must be set to anything other than View.List in order for groups to work.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        R Offline
        R Offline
        Rizwan Bashir
        wrote on last edited by
        #3

        Many Thanks.. It works :)

        Rizwan Bashir ALM Soft[^]

        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