0

i am trying to put the contents of a listbox into an array using listcount so i can sort and manipulate the data in the listbox using linq. Everytime I try to use listcount it errors and tells me that listcount is not a member of systems.windows.forms.listbox It also gives this error or list. Here is the for loop i am trying to use to put the data into the array.

 For i = 0 To displayListBox1.Listcount - 1
            sorting(i) = displayListBox1.list(i)
        Next

i dim'd i as an integer and sorting() as a string early in the program as class level variables. displayListBox1 is the name of the listbx containing the data I need to use in my LINQ inquiry. thank you.

Edited by mike_2000_17: Fixed formatting

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by samir_ibrahim
0

displayListBox1 is the name of the listbx containing the data I need to use in my LINQ inquiry. thank you.

If you want to use LINQ, I guess there is no need to store the value off the Listbox in array.

Dim _Linq As IEnumerable = From _ListBoxItems In Me.ListBox1.Items _
                           Select _ListBoxItems
For Each _Item In _Linq
    Debug.Print(_Item)
Next
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.