#974 – Properties for Retrieving Selected Items in a ListBox

You can use the following properties to find out which items in a ListBox are selected:

  • If a single item is selected:
    • SelectedIndex is the 0-based index of the selected item
    • SelectedItem refers to the selected item
    • SelectedItems is a list containing the single selected item
  • If multiple items are selected:
    • SelectedIndex is the 0-based index of the first item that the user selected
    • SelectedItem refers to the first item that the user selected
    • SelectedItems is a list containing all selected items
  • If no items in the ListBox are selected:
    • SelectedIndex is -1
    • SelectedItem is null
    • SelectedItems is null

974-002

974-003

974-001

 

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: