.NET 3.5 Listbox Selected Values (Winforms)

Posted by Jimbo on Stack Overflow See other posts from Stack Overflow or by Jimbo
Published on 2010-04-09T15:11:57Z Indexed on 2010/04/09 15:23 UTC
Read the original article Hit count: 562

I am BATTLING to get the selected values (please note VALUES not TEXT) from a Winforms Listbox that has multi-select enabled and has been bound to a database table getting the Name (as DisplayMember) and ID (as ValueMember) - I need the ID of the selected items.

The listbox control has properties for SelectedValue to get one of the selected items values, but not for all selected items values.

The SelectedItems property returns a Listbox.SelectedObjectCollection from which I cannot seem to extract the VALUES of the items.

Please help! Thanks.

© Stack Overflow or respective owner

Related posts about .net-3.5

Related posts about c#