Results 1 to 7 of 7

Thread: easy one?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    28

    Question

    I have 2 user lists.
    How do I get it so when I choose Red from the 1 user list it will be picked up in the second user list.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    is this the sort of thing you require?

    Code:
    Private Sub Form_Load()
    List1.AddItem "Red"
    
    List1.AddItem "Blue"
    List1.AddItem "Green"
    List1.AddItem "Cyan"
    List1.AddItem "Magenta"
    List1.AddItem "Yellow"
    
    List2.AddItem "Red"
    
    List2.AddItem "Blue"
    List2.AddItem "Green"
    List2.AddItem "Cyan"
    List2.AddItem "Magenta"
    List2.AddItem "Yellow"
    
    
    
    End Sub
    
    Private Sub List1_Click()
    Dim i As Integer
    For i = 0 To List2.ListCount - 1
        If List2.List(i) = List1.List(List1.ListIndex) Then
            List2.ListIndex = i
            Exit For
        End If
        
    Next i
    
    End Sub
    Mark
    -------------------

  3. #3
    Guest
    You can shorten it down a little.

    Code:
    Private Sub List1_Click()
    
        List2.Text = List1.Text
        
    End Sub

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    I feel a little nervous correcting a guru, but shouldn't it be:
    Code:
    List2.AddItem List1.Text
    "It's cold gin time again ..."

    Check out my website here.

  5. #5
    Guest
    I thought that he had 2 identical ListBox's (each with the same items) and he wanted the second ListBox to select whatever item that was selected in the first ListBox.

  6. #6
    Junior Member
    Join Date
    Jul 2000
    Posts
    17
    what does list1.text return?

  7. #7
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Hmm... I suppose Megatron's suggestion is slightly shorter!

    Mark
    -------------------

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