This documentation is archived and is not being maintained.

ComboBox.SelectedItem Property

Gets or sets currently selected item in the ComboBox.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public Object SelectedItem { get; set; }
/** @property */
public Object get_SelectedItem ()

/** @property */
public void set_SelectedItem (Object value)

public function get SelectedItem () : Object

public function set SelectedItem (value : Object)

Property Value

The object that is the currently selected item or a null reference (Nothing in Visual Basic) if there is no currently selected item.

When you set the SelectedItem property to an object, the 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 ComboBox and the SelectedIndex property is set to the corresponding index. If the object does not exist in the list the SelectedIndex property is left at its current value.

The following code example shows the usage of the SelectedIndex and the SelectedItem properties. The example is part of a complete code example in the ComboBox class overview.

private void showSelectedButton_Click(object sender, System.EventArgs e) {
    int selectedIndex = comboBox1.SelectedIndex;
    Object selectedItem = comboBox1.SelectedItem;

    MessageBox.Show("Selected Item Text: " + selectedItem.ToString() + "\n" +
                    "Index: " + selectedIndex.ToString());

private void showSelectedButton_Click(Object sender, System.EventArgs e)
    int selectedIndex = comboBox1.get_SelectedIndex();
    Object selectedItem = comboBox1.get_SelectedItem();
    MessageBox.Show("Selected Item Text: " + selectedItem.ToString() 
        + "\n" + "Index: " + ((Int32)selectedIndex).ToString());
} //showSelectedButton_Click

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0