计数列表视图行 [英] count list view rows

查看:79
本文介绍了计数列表视图行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算列表视图中第3列值为Check的行。如果listview只包含一行,则应显示消息框只存在一行。

i want to count rows in list view where 3rd column value is 'Check'. If listview contains only one row then message box should be shown "only one row exists".

推荐答案

请参阅 - 在具有特定值的ListView中计算行数 [ ^ ]。



答案建议使用linq来检查列的值并相应地计算行数。



请按照并尝试一下。
Refer - Counting Rows In A ListView Where There Are Specific Values[^].

The answer suggests to use linq to check the value of a column and count number of rows accordingly.

Please follow and try that out.


要计算ListView项目数,请使用:

To get count of ListView items count, use:
Label1.Text = ListView1.Items.Count();



ListView类 [ ^ ]

ListView属性 [ ^ ]

ListView.Items属性 [ ^



但是如果你想获得已检查项目的数量,请使用ListView.SelectedItems property [ ^ ]或 Listview.CheckedItems属性 [ ^ ]根据您的需要。


ListView Class[^]
ListView Properties[^]
ListView.Items property[^

But if you want to get count of "checked" items, use ListView.SelectedItems property[^] or Listview.CheckedItems property[^] depending of your needs.


这篇关于计数列表视图行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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