如何从c#中的listview中检索所有数据? [英] How to retrieve all the data from listview in c#?
本文介绍了如何从c#中的listview中检索所有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在listview中有6列,我想使用for / foreach循环检索6列中的所有数据。
我有点成功但显示的数据不是所需的格式。
o试过这个:
Hi,
I have 6 columns in listview and i want to retrieve all the data in the 6 columns using for/foreach loop.
I am little bit successful but the data shown are not in the desired format.
o have tried this:
foreach(ListViewItem item in lsvPPizza.Items)
{
MessageBox.Show(item.Text);
foreach(Object k in item.SubItems)
{
MessageBox.Show(k.ToString());
}
}
在消息框中显示为
in message box it shows as
listViewSubItem:{1}
和
listViewSubItem:{Dinesh}
请帮助我。
Please help me.
推荐答案
尝试:
Try:
foreach(ListViewItem item in lsvPPizza.Items)
{
MessageBox.Show(item.Text);
foreach(Object k in item.SubItems)
{
MessageBox.Show(k.Text);
}
}
这篇关于如何从c#中的listview中检索所有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文