Results 1 to 5 of 5

Thread: [RESOLVED] listbox problem....

  1. #1

    Thread Starter
    Lively Member chxxangie's Avatar
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    79

    Resolved [RESOLVED] listbox problem....

    what i want to do is, when i click on one of the item in list1, then list2 item will be selected also.
    for example: if second item in list 1 is selected, then the second item in list2 will be selected also.....
    but what i have done seem like got something wrong...

    Code:
    For a = 0 To list1.ListCount - 1
        a = list1.ListIndex
        List2.Selected(a) = true
    Next

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: listbox problem....

    Code:
    Private Sub List1_Click()
        List2.ListIndex = List1.ListIndex
    End Sub
    Or..
    Code:
    Private Sub List1_Click()
        List2.Selected(List1.ListIndex) = True
    End Sub

  3. #3
    Hyperactive Member Chathura's Avatar
    Join Date
    Nov 2005
    Location
    Sri Lanka
    Posts
    345

    Re: listbox problem....

    Try this out
    Code:
    Private Sub list1_Click()
       list2.ListIndex= List1.ListIndex
    End Sub
    If the post is heplful, Please Rate it
    Chathura Wijekoon

  4. #4

    Thread Starter
    Lively Member chxxangie's Avatar
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    79

    Re: listbox problem....

    it works...thanks......

  5. #5
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: listbox problem....

    Just in case: when using Multiselect = Simple then it's:
    Code:
    Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
       List2.Selected(List1.ListIndex) = List1.Selected(List1.ListIndex)
    End Sub
    Last edited by jcis; Mar 2nd, 2007 at 02:21 AM.

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