Sorts the items in the ListBox.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
forces the collection to add each item back to itself if the Sorted property is true. Each item is then inserted into the correct position.Notes to Inheritors
You can override this method in your derived class to provide your own sorting routine. Access the results of the overridden method by setting the Sorted property to true. When adding items to a ListBox, it is more efficient to sort the items first and then add new items.
The following code example demonstrates using the method. The example demonstrates inheriting from the ListBox class and overriding the method in the derived class to perform a user-defined sort. To run this example paste the following code in an empty form.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)