Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27408

VS 2008 Array and ListBox

$
0
0
Hello,

I am working on an assignment. It involves entering postal codes (like 1111 AA), sorting them, and showing them. We have to use arrays and listboxes.

So far, I have managed to put the postal codes in one listbox. I put the data in an array by using this:

boxList.Items.CopyTo(Array, 0)

Then I sort them based on the numbers using this:

Dim Low As Integer
Dim High As Integer
Dim Temp As Integer

For Low = LBound(Lijst) To Array.Length - 2
For High = Low + 1 To Array.Length - 1
If Low > High Then
Temp = High
High = Low
Low = Temp
End If
Next High
Next Low

Then, I want to put the sorted array into a second listbox:

For p = 0 To List.Length
boxSorted.Items.Add(List(p))
Next p

I get the following error, and the italic part is marked yellow:
Value can't be null. Parameter name: item

I don't know what it means and how I can solve it. Could anyone help me?

Viewing all articles
Browse latest Browse all 27408

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>