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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to populate a listview control

Status
Not open for further replies.

Board2Death

Technical User
Apr 27, 2005
88
US
VB6

I have never used a listview control before, and I am struggling with populating it. I have a listview control named ListView1. I would like the first column to be numbered, and the second column to be populated with strings from an array (arrNames). Basically, the ListView should display something like this:

1 Derek
2 Joe
3 Steve
4 Will
5 John

If anyone could get me moving in the right direction I would truely appreciate it. I don't need help with the actual looping through the array, just with the commands to populate the listview. TIA...
 
Something like this;
with ListView1
For i = 1 To n
.ListItems.Add , , Array(i,1)
With .ListItems(.ListItems.Count)
.ListSubItems.Add , , Array(i,2)
.ListSubItems.Add , , Array(i,3)
.ListSubItems.Add , , Array(i,4)
End With
Next
End With

I have taken it to four columns but you only seem to require two.

HTH Hugh,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top