Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Like on the pic, there is second column header and two subheaders under it ?

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
143 views
Welcome To Ask or Share your Answers For Others

1 Answer

For a complete example look at this link this should give you a full working example of what you can do Add ListView Column and Insert Listview Items

try something like this

The order in which you add values to the array dictates the column they appear under so think of your sub item headings as [0],1 etc.

Here's a code sample:

//In this example an array of three items is added to a three column listview string[] saLvwItem = new string[2];

foreach (string wholeitem in listofitems)
{
     saLvwItem[0] = "Status Message";
     saLvwItem[1] = wholeitem;
     ListViewItem lvi = new ListViewItem(saLvwItem);

     lvwMyListView.Items.Add(lvi);
}

To add SubItems you could also do something like this

lvwMyListView.Items[0].SubItems.Add("John Smith");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...