title: Sort TListBox Items Alphabetically in Delphi 7
body: <p>I am attempting to trigger a sort on the items within a <em>TListBox</em> control after adding/editing entries.</p>
  
  <p>I see that there is a <em>Sorted</em> property which I've set to true, however, this doesn't dynamically sort the <em>ListBox</em> every time I make a change to the contents. There doesn't seem to be any <em>Sort</em> procedure or function available and calling <em>Update</em> or <em>Refresh</em> does not have the desired effect.</p>
  
  <p>I've reached the stage where I'm considering pulling the contents of the <em>ListBox</em> into a <em>TStringList</em> object, sorting that and then putting everything back into the <em>ListBox</em> again. This seems a bit insane though, surely I am overlooking some better method.</p>
  
  <p>Here's an example of changing an existing item:</p>
  
  <pre><code> myListBox.Items[myIndex] := newString; // Update Text
   myListBox.Items.Objects[myIndex] := TObject(my_object); // Update associated object
  </code></pre>
  
  <p>I would expect the control to update to keep things sorted alphabetically but it doesn't.</p>