ListBox.LastIndex


Warning

This item was deprecated in version 2019r2. Please use DesktopListBox.LastAddedRowIndex as a replacement.

Description

The number of the last row added with the AddRow, AddFolder, or InsertRow method. LastIndex is zero-based. LastIndex defaults to -1. Use this to get the row number when getting or setting values in a multi-column ListBox. See the section on Multi-column listboxes in the Notes section.

Sample code

This example project consists of a two-column ListBox and two TextField creates a new row in the ListBox and adds the contents of the TextField.

PeopleList.Addrow("")
PeopleList.Cell(PeopleList.LastIndex, 0) = FirstNameField.Text
PeopleList.Cell(PeopleList.LastIndex, 1) = LastNameField.Text
PeopleList.ListIndex = PeopleList.LastIndex ' select the newly added row
FirstNameField.SetFocus

Compatibility

All projects types on all supported operating systems.