Results 1 to 6 of 6

Thread: [RESOLVED] Syncronising 2 list boxes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Resolved [RESOLVED] Syncronising 2 list boxes

    How would i syncronise 2 list boxes so that if (for example) i click the top option in 1 of them then the top value will be selected in the other one and if i click the 4th one the 4th one will be selected in the other one aswell?

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Syncronising 2 list boxes

    Is this with multiselect on? If so:
    VB Code:
    1. Private Sub List1_Click()
    2.     Dim N As Long
    3.     For N = 0 To List1.ListCount - 1
    4.         List2.Selected(N) = List1.Selected(N)
    5.     Next N
    6.     List2.TopIndex = List1.TopIndex
    7. End Sub

    If not, then just set the List2.ListIndex = List1.ListIndex in the click event.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: Syncronising 2 list boxes

    no, it isn't and i tried the bottom one but it came up with an error:

    Can't assign to read only property.

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Syncronising 2 list boxes

    hmmm, i didn't get that error, but it didn't work anyway (that's what you get for not checking code before you post it). In that case just use the first code i posted. It will work.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: Syncronising 2 list boxes

    lol, you've helped me so much it says i can't give you any more reputation point thingys until i give some to other people so i'm gonna make sure i've given everyone who's helped some before i get to giving you more ok?

  6. #6
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Syncronising 2 list boxes

    Quote Originally Posted by ahpro
    lol, you've helped me so much it says i can't give you any more reputation point thingys until i give some to other people so i'm gonna make sure i've given everyone who's helped some before i get to giving you more ok?
    No Worries

    Check out this link if you want more info about how reps work: http://www.vbforums.com/faq.php?faq=...putation_group

    Don't forget to mark this 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
  •  



Click Here to Expand Forum to Full Width