#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    35
    Rep Power
    11

    move items from Listbox to listbox


    I have a form that contains 2 listboxes. When the form loads the first list box appears the users enter the information in to a text box and on enter that information is placed in the list. Below the list I have a command button the command buttons needs to be able to get the information from list one and be viewed in list 2. Here is the catcher though after the user enters the information the user will need to go back and select the ones needed to be moved. I have set the multiselect to true so that works but I need the ones selected to be moved to listbox2 on click.

    Thaks in advance for any help you can provide.
    Jay Rye
    :Cool:
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    9
    Rep Power
    0
    heres an example to help, its from the VB help, under the forms reference.

    [vb]
    Private Sub CommandButton1_Click()
    ListBox2.Clear

    For i = 0 To 9
    If ListBox1.Selected(i) = True Then
    ListBox2.AddItem ListBox1.List(i)
    End If
    Next i

    End Sub

    [/vb]

    I hope this helps
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    35
    Rep Power
    11
    Thank you for your help. I am having trouble writing this information back to an SQL database this information is entered by the user I have an update command button and it updates the recordset but I need to set this second list box to a datasource. Any Ideas how I could do this. The other info really helped thanks again.
    Jay Rye
    :Cool:
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    9
    Rep Power
    0
    Im afraid I dont know about access, try using the help. I use it a lot and its got lots of examples.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    35
    Rep Power
    11
    I am not using Access I am using an SQL Sever Database.
    Well anyway Thanks for your help.
    Jay Rye
    :Cool:

IMN logo majestic logo threadwatch logo seochat tools logo