Unselects all items in the ListBox.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Calling this method is equivalent to setting the SelectedIndex property to negative one (-1). You can use this method to quickly unselect all items in the list.
The following code example demonstrates how to use the SelectedIndex property with the TopIndex property to move the currently selected item to the top of the list of items in the display area of the ListBox. The example further demonstrates how to remove items using the RemoveAt method of the System.Windows.Forms.ListBox.ObjectCollection class, and how to clear all item selection using the method. The code first moves the currently selected item in the ListBox to the top of the list. The code then removes all items before the currently selected item and clears all selections in the ListBox. This example requires that a ListBox containing items is added to a form and that an item is currently selected in the ListBox.