Class

ListBoxRow


Warning

This item was deprecated in version 2021r3. Please use DesktopListBoxRow as a replacement.

Description

A class used to iterator (and read the values of) the rows of a ListBox.

Properties

Name

Type

Read-Only

Shared

Selected

Boolean

Tag

Variant

Methods

Name

Parameters

Returns

Shared

Columns

Iterable

ColumnTagAt

columns As Integer

ColumnTypeAt

column As Integer

ColumnValueAt

column As Integer

Property descriptions


ListBoxRow.Selected

Selected As Boolean

Gets the selection status of the current row.

This property is read-only.

Selected is True if the row passed is selected. This property can be used to determine if the row is selected. For example,

Var rowsSelected As Integer
For Each row As ListBoxRow In ListBox.Rows
  If row.Selected Then rowsSelected = rowsSelected + 1
Next

If you allow the ListBox to have multiple items selected (see ListBox.RowSelectionType), you may want to establish a list of all the rows selected. The following example shows how to achieve that. The ListBox is named ListBox1.

Var selectedRows() As ListBoxRow ' Will hold the selected rows

For Each row As ListBoxRow In ListBox1.Rows
  If row.Selected Then
    selectedRows.AddRow(row)
  End If
Next

ListBoxRow.Tag

Tag As Variant

Gets the tag of the current row.

This property is read-only.

This example places all the rows in the ListBox named "LineItems" with a Tag value of "taxable" into an array:

Var taxableLineItems() As ListBoxRow
For Each row As ListBoxRow in LineItems.Rows
  If row.Tag = "Taxable" Then
    taxableLineItems.AddRow(row)
  End If
Next

Method descriptions


ListBoxRow.Columns

Columns As Iterable

Returns a ListBoxColumn which can be used to iterate through the columns of a ListBoxRow.

The following example iterates through all the rows of ListBox1 adding any rows where any column is blank to the rowsWithMissingValues array:

Var rowsWithMissingValues() As ListBoxRow
For Each row as ListBoxRow In ListBox1.Rows
  For Each column As ListBoxColumn In row.Columns
    If column.Value = "" Then
      rowsWithMissingValues.AddRow(row)
      Exit
    End If
  Next
Next

ListBoxRow.ColumnTagAt

ColumnTagAt(columns As Integer)

Gets the ColumnTag for a column (whose index was passed) from a ListBoxRow.

In this example, row is a ListBoxRow:

Var taxable As Boolean
If row.ColumnTagAt(4) = "Taxable" Then taxable = True

ListBoxRow.ColumnTypeAt

ColumnTypeAt(column As Integer)

Gets the Type of the column (whose index is passed) from a ListBoxRow.

In this example, row is a ListBoxRow:

Var theType As ListBox.CellTypes
theType = row.ColumnTypeAt(4)

ListBoxRow.ColumnValueAt

ColumnValueAt(column As Integer)

Gets the Value of the column (whose index is passed) from a ListBoxRow.

In this example, row is a ListBoxRow:

If row.ColumnValueAt(4) = "Taxable" Then
  MessageBox("This transaction is taxable.")
End If

Compatibility

All project types on all supported operating systems.

See also

Object parent class; ListBox, ListBoxColumn classes