Add item to Listview control

后端 未结 6 1611
-上瘾入骨i
-上瘾入骨i 2020-11-28 06:31

I have a listview in c# with three columns and the view is details. I need to add a item to each specific column but I am having a hard time with this. I have t

6条回答
  •  旧巷少年郎
    2020-11-28 07:24

    Simple one, just do like this..

    ListViewItem lvi = new ListViewItem(pet.Name);
        lvi.SubItems.Add(pet.Type);
        lvi.SubItems.Add(pet.Age);
        listView.Items.Add(lvi);
    

提交回复
热议问题