简体   繁体   中英

listview c#: how to add items to columns other than the first

My question is an exact duplicate of this : "To add items to column 1 in my listView control (Winform) I'm using listView1.Items.Add, this works fine but how do I add items to columns 2 and 3 etc? "

Lots of similar Q&A elsewhere, but none of them talk about how to add items using the WinForms interactive listView builder as opposed to coding it directly. I know how to code it, but since you can add items to the first column using the builder, I assume there must be a way to do it for the other columns.

我认为(不确定)最简单的方法是添加字符串数组,并且列表视图根据数组索引知道该列。

Right-click on the ListView and select "Edit Items..." to get the ListViewItem Collection Editor.

Select a ListViewItem (or click Add to add one and then select it). In the properties pane find SubItems in the Data category. Click on the "..." button to open the ListViewSubItem Collection Editor and you can add sub-items, which appear in the columns after the first.

You need to set the Text property of your ListViewItems and ListViewSubItems if you want to see anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM