From Xojo Documentation


ListBox.CellValueAt(RowNumber as Integer, ColumnNumber as Integer) As String

New in 2019r2

Supported for all project types and targets.

Used to read from or write to the cell based on the row and column numbers passed.


row and column are zero-based. The top-left cell is 0,0. The class constants AllColumns and AllRows can be used to specify that you wish to get or set all the values columns or rows. For example, the following specifies all columns in the last row added using AddRow or AddRowAt:

Me.CellValueAt(Me.LastAddedRowIndex, ListBox.AllColumns)

If you set this equal to a tab-delimited string, you can update the row with one line of code.

Sample Code

This example copies all cells from one ListBox into another:

ListBox2.CellValueAt(ListBox.AllRows, ListBox.AllColumns) = ListBox1.CellValueAt(ListBox.AllRows, ListBox.AllColumns)

The destination listbox will have the same number of rows and columns as the source. Headers, CellTags, RowTags and ColumnTags are not copied.

In this example, the following code populates a two-column ListBox with the names of the controls in the window and their indexes.

Var i As Integer
For i = 0 To Self.ControlCount - 1 // number of controls in window
ListBox1.AddRow(Str(i)) // first column
ListBox1.CellValueAt(Listbox1.LastAddedRowIndex, 1) = Control(i).Name // second column