开发者

VB ListBox.Items throwing compile error

I am trying to read all selected items from a listbox in Visual Basic.

Dim x As Integer
Dim testValue As String
testValue = "20"

For x = 0 To Me.ListBox1.Items.Count() - 1
      If Me.ListBox1.Items.Item(x) = testValue The开发者_运维知识库n
            MessageBox.Show ("Found it")
            Exit Sub
      End If
Next x

is the code I am trying. But When I run the code, I am getting "Compile error : Method or data member not found"

I guess I am missing some references to use "ListBox.Items" method right? What is the required references/library.

Thanks!!!


I copied and pasted your code into a new project. Added a form with a ListBox. Ran the code and it worked perfectly.

Are you sure the problem is in this part of the project?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜