From Xojo Documentation


Arrays.Count(Optional index As Integer = 1) As Integer

New in 2019r2

Supported for all project types and targets.

Returns the number of rows in the array. For multi-dimensional arrays, the number of rows in a specific dimension will be returned if the dimension is passed.


result = array.Count([Index])

Part Type Description
result Integer The number of items in the array or dimension if passed..
array Any valid data type The array that you want to search.
index Integer Optional. If the array is multi-dimensional, this would be the dimension of which you wish to have returned the number of rows. The first dimension is numbered 1. If passed a non-existent dimension, it raises an OutOfBoundsException error.

Sample Code

This example displays the number of rows in the array:

Var days() As String
days() = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
MessageBox("There are " + days.Count.ToString + " days.")

See Also

Var statement; Arrays concept