The TListBox Delphi component displays a collection of items in a scrollable list.
When dynamically adding items to the ListBox you might want to ensure that the last added item is visible - so that the user does not have to use the scroll bar to move to the end of the list.
The TopIndex property determines the index number of the item that appears at the top of the list box. While you can use this handy property to get or set the first item displayed at the top of the list box, you can also use it to ensure that the last item is visible:
ListBox1.TopIndex := -1 + ListBox1.Items.Count;By setting TopIndex to the number of the items in the list, you are sure that the last item will be visible (as well as all the items at the end of the list that can "fit" into the box).
Delphi tips navigator:
» How to Access a TRadioButton from a TRadioGroup - Disable, Change Font, etc.
« How to Programmatically Open the Recycle Bin from Delphi Code

