循环遍历listview 控件中Subitems 值

Posted dafengchui

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了循环遍历listview 控件中Subitems 值相关的知识,希望对你有一定的参考价值。

I was wanting to be able to iterate through each of my ListViews sub items and get the value from each. I have tried various things but am finding it really difficult to just get the sub item text from the second column, not the items text from the first column. Thanks.

 

foreach (ListViewItem itemRow in listView1.Items)
{             
    for (int i = 0; i < itemRow.SubItems.Count; i++) 
    {
        string dueDate = itemRow.SubItems[i].Text;
        MessageBox.Show(dueDate);
    }
}

 

以上是关于循环遍历listview 控件中Subitems 值的主要内容,如果未能解决你的问题,请参考以下文章

vb.net listview控件怎么获取列的值啊??

公共控件Listview

C# winform 的listView控件如何将单元格写入值

vb.net listview中一行数据的提取

2017-04--28Winform中ListView控件

winform 之控件ListView