Results 1 to 5 of 5

Thread: [2005] Listbox Selected Items

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2007
    Location
    South Africa > Gauteng > Pretoria
    Posts
    42

    Question [2005] Listbox Selected Items

    Hi There,

    I'm still struggling. I want the user to select only eight items and then I would like to add those eight Selecteditems to a table in Access a database. How do I add Listbox Selected items to a table?

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: [2005] Listbox Selected Items

    Hi
    Just add an insert sql statement in the middle the cycle.
    How to browse the selected items of a ListBox
    Code:
    For i As Int32 = 0 To Me.ListBox1.SelectedItems.Count - 1
                Console.WriteLine(Me.ListBox1.SelectedItems(i).ToString)
    Next
    "The dark side clouds everything. Impossible to see the future is."

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2007
    Location
    South Africa > Gauteng > Pretoria
    Posts
    42

    Re: [2005] Listbox Selected Items

    Hi,

    thanks for your help I highly appreciate it, but now instead of retrieving each column I'm retrieving rows.

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [2005] Listbox Selected Items

    Is this you wanted ?
    Code:
     Dim sSelitem() As String
            ListBox1.SelectedItems.CopyTo(sSelitem, 0)
    This will copy the selected item into a string array

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2007
    Location
    South Africa > Gauteng > Pretoria
    Posts
    42

    Re: [2005] Listbox Selected Items

    Hi

    Thanks for your help it works just fine.

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