System.Windows.Forms.ComboBox.SelectedItem Property

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

Syntax

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

Value

Documentation for this section has not yet been entered.

Remarks

When you set the ComboBox.SelectedItem property to an object, the System.Windows.Forms.ComboBox attempts to make that object the currently selected one in the list. If the object is found in the list, it is displayed in the edit portion of the System.Windows.Forms.ComboBox and the ComboBox.SelectedIndex property is set to the corresponding index. If the object does not exist in the list, the ComboBox.SelectedIndex property is left at its current value.

Note:

The System.Windows.Forms.ComboBox class searches for the specified object by using the System.Windows.Forms.ComboBox.ObjectCollection.IndexOf(object) method. This method uses the object.Equals(object) method to determine equality.

Requirements

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