更好的ListviewItem问题 [英] Better ListviewItem problem

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

问题描述

您好我在我的vb.net应用程序中使用了更好的listview控件,但似乎在使用For Each循环语句时遇到问题,因为控件的语法与vb.net中的正常listview控件的语法不同



这里是我正在尝试使用的代码..



Hello I am using the better listview control within my vb.net application but seem to have trouble using For Each loop statements as the syntax of the control is different from that of normal listview control within vb.net

here is the code I am trying to work with..

Dim item As BetterListViewItem
                           For Each item In BetterListView1.Items
                               Dim Osubitem As String = item.SubItems(1).Text
                               If Osubitem = hiber Or Osubitem = FXSAPI Or Osubitem = setup1 Or Osubitem = setup2 Then
                                   item.Remove()
                               End If
                           Next







这是我找到控件的链接..



http://www.componentowl.com/better-listview [ ^ ]





目前程序加载没有错误但不能完全运行



提前谢谢你




Here is the link where I have found the control..

http://www.componentowl.com/better-listview[^]


Currently the program loads with no error but does not work completely

thank you in advance

推荐答案

我建​​议为作者或支持提出这个问题[ ^ ],但在看到文档 [ ^ ]和课程参考 [ ^ ]。



记住,当前程序加载时没有错误,但不能完全正常工作消息根本没有提供信息。 ;(
I suggest to ask this question for the author or for support[^], but before see the documentation[^] and class reference[^].

Remeber, "Currently the program loads with no error but does not work completely" message is not informative at all. ;(


foreach语句为数组或对象集合中的每个元素重复一组嵌入式语句.foreach语句用于迭代集合以获取所需信息,但是不应该用来改变集合的内容,以避免不可预测的副作用。



http://msdn.microsoft.com/en-us/library/ttw7t8t6(v = vs.80).aspx [ ^ ]



一个可能的解决方案是:

The foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreach statement is used to iterate through the collection to get the desired information, but should not be used to change the contents of the collection to avoid unpredictable side effects.

http://msdn.microsoft.com/en-us/library/ttw7t8t6(v=vs.80).aspx[^]

A possible solution would be:
For i = BetterListView1.Items.Count - 1 To 0 Step -1
    Dim Osubitem As String = item.SubItems(1).Text
    Select Case Osubitem
	Case "hiber"
	 BetterListView1.Items.RemoveAt(i)
	Case "FXSAPI"
	 BetterListView1.Items.RemoveAt(i)
	Case "setup1"
	 BetterListView1.Items.RemoveAt(i)
	Case "setup2"
	 BetterListView1.Items.RemoveAt(i)
    End Select
Next







基于此页面提供的信息: http://www.componentowl.com/documentation/better-listview/data/chapter-collections.html [ ^ ]



我想你还应检查:删除所有方法


这篇关于更好的ListviewItem问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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