Returns a value indicating whether the specified item is selected.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
You can use this method to quickly determine whether a specified item is selected. This method is useful when a specific operation needs to be performed when a specific item in a multiple-selection ListBox is selected.
The following code example demonstrates how to use the method to determine which items in a ListBox are selected in order to select the items that are not selected and deselect the items that are selected. The example also demonstrates using the SelectionMode property to enable a ListBox to have more than one selected item and uses the Sorted property to demonstrate how to sort items in a ListBox automatically. This example requires that a ListBox, named listBox1, has been added to a form and that the InitializeMyListBox method defined in the example is called from the Load event of the form.