Results 1 to 3 of 3

Thread: [2005] Transferring items from one listview to another.

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    63

    Resolved [2005] Transferring items from one listview to another.

    Hey, hope there is a simple solution, i cannot find one but I'm sure there is. I have 2 list view controls and i want whatever data goes into one or is removed from one, it happens to the other as well.

    The listviews are on different forms, so it just has to be updated on form load.

    So When form2 is loaded it checks the items in form1listview and adds all the items from form1listview to form2listview.

    Hope that makes sense.

    Thanks
    Last edited by Wulfgur; Dec 26th, 2007 at 04:53 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Transferring items from one listview to another.

    Just loop through the items in the first ListView and call the Clone method of each, then add the copy to the second ListView. You could then loop through the items in the second ListView and assign each one's index to its Tag property. Once you're done editing it will then be easy to determine which items in the original ListView to add, edit or delete.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    63

    Re: [2005] Transferring items from one listview to another.

    Thanks for the help, i got it to work with this code:
    vb Code:
    1. For Each lvi As ListViewItem In Options.Orderbox.Items
    2.  
    3.             Checkoutbox.Items.Add(lvi.Clone)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width