Results 1 to 2 of 2

Thread: Help needed!

  1. #1

    Thread Starter
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Question Help needed!

    i am having two listbox and want to add items selected in list1 to list2.
    This code is for adding all items to list 2
    VB Code:
    1. Private Sub Command1_Click()
    2. For i = 0 To List1.ListCount - 1
    3. List2.AddItem List1.List(i)
    4. Next i
    5. End Sub
    But i dont know how to add only selected items from list1 to list2.
    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help needed!

    VB Code:
    1. Private Sub Command1_Click()
    2. For i = 0 To List1.ListCount - 1
    3.    If List1.Selected(i) = True Then
    4.       List2.AddItem List1.List(i)
    5.    End If
    6. Next i
    7. 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