Results 1 to 10 of 10

Thread: 2 list box !! ?? !!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    I have 2 list box ..
    when I click on the first one , I want to unselect all the selected item in the second..
    I try this code:

    list1.selected = false

    but vb make an error .. ( hhhhhaaaa! )
    can anyone help ?

  2. #2
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Wink

    Private Sub Command1_Click()
    List1.Selected(List1.ListIndex) = False
    End Sub
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    this command will unselect ALL the item in the list box ??

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    hum..
    look :


    I select and item in the first listbox..
    I select and item in the second listbox..
    The first list box unselect all the item ..
    BUT I DONT WANT TO UNSELECT THE ITEM IN THE SECOND !!

    I want to the item stay selected in the list box I work but not in the other one ..

  5. #5
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Question

    Sorry but I can't get your point.

    How could the item in the second get unselected when you select it???

    more discribtion needed here.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    look :

    i select two item in the first listbox ....

    after, i select one into the SECOND list box ..

    the FIRST list box must UNSELECT all the selected items

    and dont unselect the item into the SECOND list box..

    understand ??
    only one list box can have selected item at the same time ..

  7. #7
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85
    What is the problem then? you can use for...next loop to unselect all the items:

    Private Sub List2_GotFocus()

    For i = 0 to list1.Count - 1
    list1.selected(i) = False
    Next

    End Sub


    Private Sub List1_GotFocus()

    For i = 0 to list2.Count - 1
    list1.selected(i) = False
    Next

    End Sub

    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    you dont understand..
    it's not important..
    I make another way to do what I want..
    It's because I speak french and I can't explain
    what I really want in english ..

    thank's a lot ;0)

  9. #9
    Guest
    Understood!

    Code:
    Private PubTex As String
    
    Private Sub Form_Load()
      PubTex = List2.Text
    End Sub
    
    Private Sub List2_Click()
      Dim cy As Integer
      cy = 0
      If List2.Text <> PubTex Then
        Do Until List1.ListCount < 0
          cy = cy + 1
          List1.Selected(cy) = False
        Loop
      End If
      PubTex = List2.Text
    End Sub
    Enjoy Also, try to understand it.

  10. #10
    Guest
    pro2: Quand est le question?

    [Note: my french grammar and spelling is VERY bad. You can try Matthew Gates.] 'Il comprehend beaucoup français.'

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