Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I have a Multiselect Listbox and I want to capture the items that have been selected. How do I do that ? SelectedIndex gives the Index of the first item that has been selected. How do i go through the entire list ?

 

Thanks

Leena

Posted

Re: Listbox Items

 

I know SelectedIndices or SelectedItems but I am not sure how to use them ? Do i loop through them ? Can you give me some sample code ?

  • *Experts*
Posted

Didn't notice that you replied to this thread until the latest reply by CattleRustler. :)

Here is some sample code:

Dim os As ListBox.SelectedObjectCollection 'declare the collection object
os = ListBox1.SelectedItems 'fill it in
For x As Integer = 0 To os.Count - 1 'go through each and display it
    MessageBox.Show(Convert.ToString(os.Item(x)))
Next

Sorry for the delay :).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...