how to Add ListviewItem in ListViewGroup ?
-
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
-
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
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'sView
property must be set to anything other thanView.List
in order for groups to work.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
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'sView
property must be set to anything other thanView.List
in order for groups to work.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007