Class
DesktopListBoxRow
Description
A class used to iterate (and read the values of) the rows of a DesktopListBox.
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
column As Integer |
|||
column As Integer |
|||
columns As Integer |
|||
column As Integer |
|||
column As Integer |
|||
lb As DesktopListBox, row As Integer |
Property descriptions
DesktopListBoxRow.ColumnCount
ColumnCount As Integer
Returns the number of columns in the row.
This property is read-only.
DesktopListBoxRow.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 DesktopListBox to have multiple items selected (see RowSelectionType), you may want to establish a list of all the rows selected. The following example shows how to achieve that. The DesktopListBox is named ListBox1.
Var selectedRows() As DesktopListBoxRow ' Will hold the selected rows
For Each row As ListBoxRow In ListBox1.Rows
If row.Selected Then
selectedRows.AddRow(row)
End If
Next
DesktopListBoxRow.Tag
Tag As Variant
Gets the tag of the current row.
This property is read-only.
This example places all the rows in the DesktopListBox named "LineItems" with a Tag value of "taxable" into an array:
Var taxableLineItems() As DesktopListBoxRow
For Each row As DesktopListBoxRow in LineItems.Rows
If row.Tag = "Taxable" Then
taxableLineItems.AddRow(row)
End If
Next
Method descriptions
DesktopListBoxRow.CellCheckBoxStateAt
CellCheckBoxStateAt(column As Integer) As DesktopCheckBox.VisualStates
Used to get or set the state of the cell at the column passed. This assumes that the passed cell is a CheckBox cell. Use the CellType property to set a cell to a CheckBox cell. DesktopCheckBox.VisualStates is an Enum of the DesktopCheckBox class.
The CellCheckBoxStateAt method enables you to get or set the value of a tri-state Checkbox cell. Any cell of type TypeCheckbox box can store one of three values: Checked, Unchecked, and Indeterminate.
To set up a cell as TypeCheckbox, use code such as this in the Opening event:
Me.CellTypeAt(1, 0) = DesktopListBox.CellTypes.CheckBox
To change the state of the cell, use the VisualStates enum of the DesktopCheckBox control:
ListBox1.CellCheckBoxStateAt(1, 0) = DesktopCheckbox.VisualStates.Indeterminate
The Indeterminate state places a minus sign in the checkbox (macOS) or filled in checkbox (Windows and Linux).
DesktopListBoxRow.CellCheckBoxValueAt
CellCheckBoxValueAt(column As Integer) As Boolean
Checks or unchecks the checkbox in the passed cell.
DesktopListBoxRow.CellTagAt
CellTagAt(columns As Integer) As Variant
Gets the CellTag for a cell (whose column index was passed) from a DesktopListBoxRow.
In this example, row is a DesktopListBoxRow:
Var taxable As Boolean
If row.CellTagAt(4) = "Taxable" Then taxable = True
DesktopListBoxRow.CellTextAt
CellTextAt(column As Integer) As String
Gets the text of the cell (whose column index is passed) from a DesktopListBoxRow.
In this example, row is a DesktopListBoxRow:
If row.CellTextAt(4) = "Taxable" Then
MessageBox("This transaction is taxable.")
End If
DesktopListBoxRow.CellTypeAt
CellTypeAt(column As Integer) As DesktopListBox.CellTypes
Gets the Type of the cell (whose column index is passed) from a DesktopListBoxRow.
In this example, row is a DesktopListBoxRow:
Var theType As DesktopListBox.CellTypes
theType = row.CellTypeAt(4)
DesktopListBoxRow.Constructor
Constructor(lb As DesktopListBox, row As Integer)
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a new DesktopListBoxRow from the DesktopListBox and row number passed.
Compatibility
Desktop projects on all supported operating systems.
See also
Object parent class; DesktopListBox classes