|
-
Oct 8th, 2001, 02:42 AM
#1
Addind records to a listview
What is the code to add records from a recordset to a listview control?
-
Oct 8th, 2001, 05:04 AM
#2
Need-a-life Member
Code:
rs.MoveFirst
Do While Not rs.EOF
'Replace the following line with the correct data
ListView1.ListItems.Add , Key, Text, Icon, SmallIcon
rs.MoveNext
Loop
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 8th, 2001, 06:32 AM
#3
VB Code:
SQL = "SELECT name, type, webaddress FROM websites "
Set WebRs = WebDb.OpenRecordset(SQL, dbOpenDynaset)
'by setting a reference to the field name, VB does not have
'to iterate through the fields collection each time it goes
'through the loop
Set FieldName = WebRs.Fields("name")
Do While Not WebRs.EOF
Set MyItem = lvWebSites.ListItems.Add(, , FieldName.Value)
MyItem.SubItems(1) = WebRs("type")
MyItem.SubItems(2) = WebRs("webaddress")
WebRs.MoveNext
Loop
lvWebSites is my ListView control. FieldName is a form level variable dimensioned As Field. type and webaddress are fields in my Access database.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|