简体   繁体   English

比较Listview子项

[英]Compare Listview Subitems

I am not so sure how i should code this properly: I loop through all Listview Subitems. 我不确定如何正确编码:我遍历所有Listview子项。

If ListViewMain.Items.Count > 0 Then
        For Each Item As ListViewItem In ListViewMain.Items
            MsgBox(Item.SubItems(5).Text)
        Next
    End If

And only if the strings in the subitem of all items in the listview are the same show a "OK"-message, if only one is not the same like the others then show a "Not-Ok"-Message. 并且仅当列表视图中所有项目的子项中的字符串相同时,才显示“ OK”消息,如果只有一个与其他字符不同,则显示“ Not-Ok”消息。 How can i do this the fastest, most efficiently way? 我如何最快,最有效地做到这一点? I thought about a List Of String and compare them somehow, other ideas? 我考虑过一个字符串列表,并以某种方式比较它们,还有其他想法吗?

Nevermind I got it:) 没关系,我明白了:)

   If Userlist.Any(Function(d) d <> Userlist(0)) Then
        'Different Items
    Else
        'Same items
    End If

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM