Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you put into an array the selected items from a listview

Status
Not open for further replies.

bigracefan

Programmer
Apr 2, 2002
304
0
0
US
I want to put my selected items into an array and I can't seem to get this code correct. This is what I have so far.

Dim i As Integer
Dim a As Integer
Dim MyParts(2, 5000) As Variant

For a = 0 To lvParts.ListItems.Count - 1
If lvParts.SelectedItem.Index = True Then
MyParts(0, a) = lvParts.SelectedItem
MyParts(1, a) = lvParts.SelectedItem.SubItems(1)
End If
Next a
[\b]
 
You're Almost there !!!

Just a simple change below.

Dim i As Integer
Dim a As Integer
Dim MyParts(2, 5000) As Variant

For a = 0 To lvParts.ListItems.Count - 1
If lvParts.ListItems(a).Selected = True Then
MyParts(0, a) = lvParts.listitems(a)
MyParts(1, a) = lvParts.ListItems(a).SubItems(1)
End If
Next a

Hope it works !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top