System.Windows.Forms.ListBox.SelectedItem Property

Gets or sets the currently selected item in the System.Windows.Forms.ListBox.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.Bindable(true)]
public object SelectedItem { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

For a standard System.Windows.Forms.ListBox, you can use this property to determine which item is selected in the System.Windows.Forms.ListBox. If the ListBox.SelectionMode property of the System.Windows.Forms.ListBox is set to either SelectionMode.MultiSimple or SelectionMode.MultiExtended (which indicates a multiple-selection System.Windows.Forms.ListBox) and multiple items are selected in the list, this property can return any selected item.

To retrieve a collection containing all selected items in a multiple-selection System.Windows.Forms.ListBox, use the ListBox.SelectedItems property. If you want to obtain the index position of the currently selected item in the System.Windows.Forms.ListBox, use the ListBox.SelectedIndex property. In addition, you can use the ListBox.SelectedIndices property to obtain all the selected indexes 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