Darryl Darryl - 1 month ago 6
Vb.net Question

Is there a way in Visual Basic to add items from a ListView1 to a ListView2?

did not know how to exactly ask the title question. i have a listview1 box with 2 columns. first column has players name and second column has players scores. listview2 box has the players name and scores from another game. i need to add the score from listview1 to listview2 to give a grand total score of both games and to not add the players name twice but just add the total scores together and have the grand total in listview2. i have tried adding the scores subitems but had no luck. i also have tried clone

ListView2.Items.Add(ListView1.Items(0).Clone())


but didnt work to add what i need.

anyone have any ideas the best way to do this?
thank you in advanced.

Answer

Use a button to transfer data from Listbox 1 to Listbox 2

If you want to transfer ALL items from Listbox 1 to Listbox 2 then you should use 'FOR NEXT LOOP'

Example:

Listbox2.Items.Clear() Clear first the data in ListBox 2

then add this loop assuming you want to select all data

For i = 0 To Listbox1.Items.Count - 1

    Listbox2.Items.Add(Listbox1.Items(i).ToString)

Next