Results 1 to 5 of 5

Thread: [RESOLVED] How to sent listbox items to other items?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] How to sent listbox items to other items?

    I would like to know, how I can sent the listbox items from one listbox ("LIST1") to another listbox ("LIST2") and clear the selected items from list1?

  2. #2
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: How to sent listbox items to other items?

    Code:
    Private Sub Command1_Click()
    For i = 0 To List1.ListCount - 1
    List2.AddItem List1.List(i)
    Next i
    End Sub
    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

  3. #3
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: How to sent listbox items to other items?

    for removing selected items

    Code:
    Sub ListBoxRemSel(lst As ListBox)
        Do Until lst.SelCount = 0
            If lst.Selected(a) Then lst.RemoveItem a: a = a - 1
            a = a + 1
        Loop
    End Sub
    
    Private Sub Command1_Click()
    Call ListBoxRemSel(List1)
    End Sub
    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: How to sent listbox items to other items?

    Here is the code I have corrected

    Code:
    Private Sub List1_DblClick()
        On Error Resume Next
        List2.AddItem List1.Text
        List1.RemoveItem List1.ListIndex
    End Sub
    Private Sub List2_DblClick()
        On Error Resume Next
        List1.AddItem List2.Text
        List2.RemoveItem List2.ListIndex
    End Sub

  5. #5
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: [RESOLVED] How to sent listbox items to other items?

    U said that u want to send items to list2. U did not say that i want it when i doubleclick it. Anyway ur prob is solved.
    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

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