|
-
May 26th, 2005, 10:47 AM
#1
Thread Starter
Lively Member
Get content of 2 listview
hi
Im having two user control on a same form that contains 2 listview. id like to take the content of 1 listview by usercontrol and put it in another listview
im presently able to do the content of one listview in one user control but i dont know how to get the content of the second one in the other user control
somebody have an idea ??
here is the code for the content of the first listview :
VB Code:
For i = 1 To lvwAlarmList.ListItems.Count
Set itmx = lvwAlarmePrint.ListItems.Add(, , lvwAlarmList.ListItems.Item(i))
For j = 1 To lvwAlarmList.ColumnHeaders.Count - 1
itmx.SubItems(j) = lvwAlarmList.ListItems.Item(i).SubItems(j)
Next j
Next i
thanks
-
May 26th, 2005, 12:04 PM
#2
Thread Starter
Lively Member
Re: Get content of 2 listview
Anybody has a little idea of how i could do this ??
-
May 26th, 2005, 12:13 PM
#3
Re: Get content of 2 listview
 Originally Posted by DesyM
hi
Im having two user control on a same form that contains 2 listview. id like to take the content of 1 listview by usercontrol and put it in another listview
im presently able to do the content of one listview in one user control but i dont know how to get the content of the second one in the other user control
somebody have an idea ??
here is the code for the content of the first listview :
VB Code:
For i = 1 To lvwAlarmList.ListItems.Count
Set itmx = lvwAlarmePrint.ListItems.Add(, , lvwAlarmList.ListItems.Item(i))
For j = 1 To lvwAlarmList.ColumnHeaders.Count - 1
itmx.SubItems(j) = lvwAlarmList.ListItems.Item(i).SubItems(j)
Next j
Next i
thanks 
If I am understanding your question correctly you want to copy the contents of Listview #1 into Listview #2 while taking the contents of Listview #2 and copy it into Listview #1? Is this correct? If this is what you are looking to do then you might want to put a third listview on your form and prior to copying the data from Listview #1 to Listview #2 you copy the data from Listview #2 to Listview #3 then copy Listview #1's data to Listview #2 and then copy Listview #3 to Listview #1 using your code:
VB Code:
For i = 1 To Listview2.ListItems.Count
Set itmx = Listview3.ListItems.Add(, , Listview2.ListItems.Item(i))
For j = 1 To Listview2.ColumnHeaders.Count - 1
itmx.SubItems(j) = Listview2.ListItems.Item(i).SubItems(j)
Next j
Next i
For i = 1 To Listview1.ListItems.Count
Set itmx = Listview2.ListItems.Add(, , Listview1.ListItems.Item(i))
For j = 1 To Listview1.ColumnHeaders.Count - 1
itmx.SubItems(j) = Listview1.ListItems.Item(i).SubItems(j)
Next j
Next i
For i = 1 To Listview2.ListItems.Count
Set itmx = Listview3.ListItems.Add(, , Listview2.ListItems.Item(i))
For j = 1 To Listview2.ColumnHeaders.Count - 1
itmx.SubItems(j) = Listview2.ListItems.Item(i).SubItems(j)
Next j
Next i
I haven't tested this code but it should work.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
May 26th, 2005, 12:18 PM
#4
Thread Starter
Lively Member
Re: Get content of 2 listview
the only problem that ive got is that my listviews are notre on the same user control,,,,so i can only read one listview...so i try to understand how can i tell that im on usercontrol 1 or usercontrol2
thanks
-
May 26th, 2005, 03:12 PM
#5
Re: Get content of 2 listview
 Originally Posted by DesyM
the only problem that ive got is that my listviews are notre on the same user control,,,,so i can only read one listview...so i try to understand how can i tell that im on usercontrol 1 or usercontrol2
thanks
Could you post your code or zip up the project, so I can try to understand what you are looking to do.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
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
|