Hi,

When I try and populate a listview with data from an array with 3 entries I find that the data goes into the wrong columns.
The array consists of the following.

 ?ID
{Length=3}
    (0): "T123456789"
    (1): "001"
    (2): "Smith"

My list view has columns : ID, Location, Name.

My code looks like this :

If Not results Is Nothing Then
            For Each ID As String() In results
                Dim lvitem As New ListViewItem(ID(2))
                lvitem.SubItems.Add(ID(0))
                lvitem.SubItems.Add(ID(1))
                lvResults.Items.Add(lvitem)
            Next
End If

The results look like this :

ID = Smith
Location = T123456789
Name = 001

It should read :

ID = T123456789
Location = 001
Name = Smith

Can anybody please give me some help?
Thanks.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

I have solved this my self.
The answer is :
If Not results Is Nothing Then
For Each ID As String() In results
Dim lvitem As New ListViewItem(ID(0))
lvitem.SubItems.Add(ID(1))
lvitem.SubItems.Add(ID(2))
lvResults.Items.Add(lvitem)
Next
End If

This question has already been answered. Start a new discussion instead.