C# - adding new groups with items and subitems to a listview
- by Nike
Hello there.
The following code adds a new item, and a new group with the text "Default". If i keep clicking the button, it will just keep adding new items to that particular group.
ListViewItem item = new ListViewItem("");
item.SubItems.Add("");
csslistview.Items.Add(item);
What i'm trying to do, is to add a new group and fill it with one empty item, aswell as one empty subitem. And when i click the button again, i want it to create a new group, and do the same thing. I have a textbox were the user has to fill in the name of the group, so there wont be any groups with the same name (hopefully).
The following code, i think, creates a new group:
ListViewGroup group = new ListViewGroup(newGroupName);
group.Items.Add(newGroupName);
csslistview.Groups.Add(group);
but as empty groups aren't showed, i can't really verify that it actually creates new groups.
Well, thanks in advance.
-Nike