System.Windows.Forms.ListBox.SelectedItems Property

Gets a collection containing the currently selected items in the System.Windows.Forms.ListBox.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public ListBox.SelectedObjectCollection SelectedItems { get; }

Value

Documentation for this section has not yet been entered.

Remarks

For a multiple-selection System.Windows.Forms.ListBox, this property returns a collection containing all items that are selected in the System.Windows.Forms.ListBox. For a single-selection System.Windows.Forms.ListBox, this property returns a collection containing a single element containing the only selected item in the System.Windows.Forms.ListBox. For more information about how to manipulate the items of the collection, see System.Windows.Forms.ListBox.SelectedObjectCollection.

The System.Windows.Forms.ListBox class provides a number of ways to reference selected items. Instead of using the ListBox.SelectedItems property to obtain the currently selected item in a single-selection System.Windows.Forms.ListBox, you can use the ListBox.SelectedItem property. If you want to obtain the index position of an item that is currently selected in the System.Windows.Forms.ListBox, instead of the item itself, use the ListBox.SelectedIndex property. In addition, you can use the ListBox.SelectedIndices property if you want to obtain the index positions of all selected items in a multiple-selection System.Windows.Forms.ListBox.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0