如何检查listview子项是空的 [英] How to check listview subitem is empty

查看:97
本文介绍了如何检查listview子项是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的窗口应用程序中,我有4列的列表视图。我想检查第3个子项是否为空或所有行。如果它是空的我需要提示error.how检查子项3不没有任何值?

In my window application i have list view with 4 column.i want to check 3rd sub item is empty or not in all the rows.if it was empty i need to prompt an error.how to check sub-item 3 doesn't have any values?

推荐答案

If myListView.Items(17).SubItems(3) Is Nothing Or myListView.Items(17).SubItems(3).Text <> "" Then





如果您需要全部检查:





Or if you need to check all:

Dim emptyFieldExists As Boolean = False

For Each item As ListViewItem In myListView.Items
    If item.SubItems(3) Is Nothing Or item.SubItems(3).Text <> "" Then
        emptyFieldExists = True
    End If
Next

If emptyFieldExists Then
    'Do what you need to do!
End If


这篇关于如何检查listview子项是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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