|
-
April 9th, 2001, 09:40 AM
#1
How to Read data from a ListView
Hi There,
This is the scenario.
I have some data and I am populating the data to a ListView after doing some changes. I am doing this by using the .ListItems.add and .ListSubItems.Add. The code is as follows
Dim FirstStorecol as ListItem
Dim NextStoreCol as ListSubItem
set FirstStorecol = lvSelStores.ListItems.Add(, , StoreNo)
set NextStoreCol = FirstStorecol.ListSubItems.Add(, , Address)
set NextStoreCol = FirstStorecol.ListSubItems.Add(, , City)
Well I am able to see the data in the listbox. My problem is to read this data from the ListView as a whole and save that to another table. I can use the ListView.count to find the no of items in the ListView, But I want to read the whole data in the ListView and save it to a table.
Actually I would like to read only the first column data ie StoreNo, no need to read the listviews subitems. Only the first column data is required. What all data are there in the first column, I should be able to read and save that into a table. For eg if the ListView has 10 values under the StoreNo Column I should be able to read all these and save that to a table with StoreNo as a field. All the other columns in the ListView are for display purpose only.
I would really appreciate your help if somebody was able to give me some advice or suggestions or even code for the above matter.
Thanking You in Advance
Dipu Thomas
-
April 9th, 2001, 12:22 PM
#2
Re: How to Read data from a ListView
Hi,
This is what i used in my project to show records from a database on my listview
I hope this helps. Post another message if you need more help. Samantha
rsinfo.moveFirst
Do Until rsinfo.EOF
Set itmx = lsvlistivew.ListItems.Add(, , rsinfo("table_nme"))
itmx.SubItems(1) = rsinfo("table_desc")
itmx.SubItems(2) = rsinfo("engglish_txt")
rsinfo.MoveNext
Loop
-
April 9th, 2001, 12:27 PM
#3
Re: How to Read data from a ListView
Hi,
I used this code to display records from a database on my listview. I hope this helps you
out
rsinfo.MoveFirst
Do Until rsinfo.EOF
Set itmx = lsvListview.ListItems.Add(, , rsinfo("name"))
itmx.SubItems(1) = rsinfo("age") & ""
itmx.SubItems(2) = rsinfo("height") & ""
itmx.SubItems(3) = rsinfo("experience") & ""
rsinfo.MoveNext
Loop
End If
-
April 9th, 2001, 12:50 PM
#4
Re: How to Read data from a ListView
private function SaveList(LV as listView)
dim lngCnt as long
dim lngLoop as long
lngcnt = lv.listitems.count
for lngloop = 1 to lngcnt
'Hear you need to add your openconnection and sql statements in a saveListItem function
saveListItem lv.listitems(x).text
next
-
April 9th, 2001, 01:33 PM
#5
Re: How to Read data from a ListView
Thank You Sir, I really appreciate ur help
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
|