WebListBox.LastIndex

From Xojo Documentation

Read-Only Property (As Integer )


IntegerValue = aWebListBox.LastIndex

Supported for all project types and targets.

The number of the last row added with the AddRow 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.

Example

This example project consists of a two-column ListBox and two TextFields for the entry of first and last names. A PushButton creates a new row in the WebListBox and adds the contents of the TextFields to the ListBox. The LastIndex property is used to determine the next empty row in the WebListBox. The code is as follows:

peopleList.addrow ""
peopleList.Cell( peopleList.LastIndex, 0 ) = firstname.Text
peopleList.Cell( peopleList.LastIndex, 1 ) = lastname.Text
peopleList.listindex = peopleList.lastindex
firstname.setfocus