从ListView提取值 [英] Extracting Values from ListView

查看:91
本文介绍了从ListView提取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在应用程序中使用ListView.我在Listview控件中创建了三列.现在我想通过提供列名来提取特定的列值.是否可以通过提供列名来提取列值?
在此先感谢

Hi,
Im using a ListView in my application.I created three columns in that Listview Control.Now i want to extract particular column values by providing the column name.Is it possible to extract the column values by providing column name?
Thanks in advance

推荐答案

您好

不,没有直接的方法通过使用Listview列名来提取列值.您可以使用以下代码通过使用子项目上的库伦索引来从listview特定列中获取值,listview的 Subitem(0 )用于listview的第一列

//获取第一列的Listview的每一行
//其中 i 是行号

for(int i = 0; i< this.listView1.ListItems.Count; i ++)
{
listView1.ListItems [i] .SubItems [i] .ToString()
}
Hi

No, there is no direct way of extracting column values by using listview column name. You can use the below code to get the value from listview specific column by using the index of the coulmn on subitem, Subitem(0) of listview is for first column of the listview

// Get each row of the Listview for first column
// where i is row number

for (int i = 0; i< this.listView1.ListItems.Count; i++)
{
listView1.ListItems[i].SubItems[i].ToString()
}


这篇关于从ListView提取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆