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!

Really quick question (ListViews) 2

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
0
0
GB
Hi,

How do i place an item into the second column of a list view??? This inserts my first value into the first column:

lvFunctions.ListItems.Add intIndex, , prsData!FunctionCode

Thnx,
Jonathan
 
ie. how do I move from the first column to the second???
 
The following code should help you. It loops through a recordset and adds the information to a list view

Dim OneLine As ListItem
While Not RS.EOF
Set OneLine = lvwName.ListItems.Add
With OneLine
.Text = RS.fields(0).value
.SubItems(1) = RS.fields(1).value
.SubItems(2) = RS.fields(2).value
.SubItems(3) = RS.fields(3).value
.SubItems(4) = RS.fields(4).value
.SubItems(5) = RS.fields(5).value
.SubItems(6) = RS.fields(6).value
End With
RS.movenext
wend


Hope this helps
David
 
The above function returns a ListItem object which is the item you have just added. Within this object there is a collection of ListSubItems which has an add method to add new items: thus-

dim objXXX as Listitem

set objXXX = lvFunctions.ListItems.Add intIndex, , prsData!FunctionCode

objXXX.ListSubItems.Add

Hope this helps,

Chris Dukes


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top