Results 1 to 4 of 4

Thread: Copy the data contents from a combo box to another combo

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    62

    Exclamation Copy the data contents from a combo box to another combo

    I have in my project a combo box(a) that in run time I must to copy to another combo box(b)

    in the a combo box have items that are in the combo and also Itemdata to every item data
    I succed to copy the items but not the Itemdata to every items

    dim i as integer

    For i = 0 To cboOperators(2).ListCount
    newFrmStart(i).cboOperators(0).AddItem cboOperators(0).List(i)
    newFrmStart(i).cboOperators(2).AddItem cboOperators(2).List(i)
    Next i

    Please advice how to copy thr itemdata in run time

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Copy the data contents from a combo box to another combo

    VB Code:
    1. 'Generalized
    2. For x = 0 To Combo1.ListCount - 1
    3.         Combo2.AddItem Combo1.List(x)
    4.         Combo2.ItemData(Combo2.NewIndex) = Combo1.ItemData(x)
    5.     Next
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    62

    Talking Re: Copy the data contents from a combo box to another combo

    Quote Originally Posted by Static
    VB Code:
    1. 'Generalized
    2. For x = 0 To Combo1.ListCount - 1
    3.         Combo2.AddItem Combo1.List(x)
    4.         Combo2.ItemData(Combo2.NewIndex) = Combo1.ItemData(x)
    5.     Next

    Hi Static
    The code run fine thank you very much

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Copy the data contents from a combo box to another combo

    Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer. Also if someone has been particularly helpful, or even particularly unhelpful, you have the ability to affect a their forum "reputation" by rating their post.

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