leenu_n Posted November 4, 2003 Posted November 4, 2003 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 Quote
*Experts* mutant Posted November 4, 2003 *Experts* Posted November 4, 2003 Did you try SelectedIndices or SelectedItems? Quote
leenu_n Posted November 4, 2003 Author Posted November 4, 2003 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 ? Quote
CattleRustler Posted November 8, 2003 Posted November 8, 2003 loop thru the listbox and look at each items Selected property Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
*Experts* mutant Posted November 8, 2003 *Experts* Posted November 8, 2003 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 :). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.