I have this little bit of code that I found was erroring… I am trying to set the checkbox to either True or False depending on which record in the listbox has been selected - so selected rows are True, non-selected are False.
For i As Integer = 0 To Me.RowCount
If Me.Selected(i) = True Then
Me.CellCheckBoxValueAt(i ,0 )= True
ElseIf Me.Selected(i) = False Then
Me.CellCheckBoxValueAt( i, 0) = False
End If
Next i
Reviewing it, it appears that, according to the docs, I am doing it incorrectly. The docs show
CellCheckboxValueAt(column As Integer, Assigns value As Boolean)
Sets the checkbox value of a cell of a WebListBox based on the given column index.
However, the ID Shows this
WebListBox.CellCheckBoxValueAt(row As Integer, column As Integer, Assigns value As Boolean)
Note the difference is the IDE shows Row, Col, Value BUT the docs show no ROW, only Column and Value.
Can you provide the error that you are getting?
Are you using WebListbox with or without DataSource?
My guess is that you are looking at the documentation for WebListboxRowData (that describes a row that uses the DataSource interface, and that is why no row is used) and CellCheckBoxValueAt without DataSource (in the IDE) that needs row and column (and I can’t find in the documentation).
Only when using a WebDataSource, WebListBoxRowData.CellCheckboxValueAt doesn’t have a row parameter, as it’s already a row. Just the column and value will be required in that case.
This code works. What I was trying to do is to change the check back to unchecked if the row is not selected.
For i As Integer = 0 To Me.RowCount -1
If Me.CellCheckBoxValueAt(i ,0 )= True And Me.Selected(i) = False Then
Me.CellCheckBoxValueAt( i, 0) = False
ElseIf Me.Selected(i) = True Then
Me.CellCheckBoxValueAt(i ,0 )= True
End If
Next i