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 :wave:
Re: Get content of 2 listview
Anybody has a little idea of how i could do this ??
Re: Get content of 2 listview
Quote:
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 :wave:
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.
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
Re: Get content of 2 listview
Quote:
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.