Zebra0.com

csharp loops

Sorted

By default, the sorted

When a list box listboxis added to the form, the sorted property is false. You can change it in either the properties window, or at run time by adding the line below to Form Load:

listBox1.Sorted = false;

If the sorted property of the listbox is true, the values are sorted as strings. That means that "2" comes after "11" because "2" comes after "1", "10", or any value that begins with "1".

If you have set the sorted property to true, it may seem that the loop is not acting as expected.

End of lesson, Next lesson: