Search code examples
c#winformslistviewsubitem

Add subItem to Listview


Now, I know how to add SubItems, but this time it's slightly different from my usual method. below is what I'm using to add items to my listview, however using this I cannot figure out how to add subitems.

listView1.Items.Add(Path.GetFileName(f));

Solution

  • Try this:

    listView1.Items.Add(Path.GetFileName(f));
    
    listView1.Items[0 /* or any index you need */].SubItems.Add("SubItem");