I hope I’m missing something but how can I tell the number of selected items in a WebListBox without having to cycle through the entire list? On a standard ListBox I can us the SelCount property but that doesn’t seem to exist in the web version.
You do have to cycle through and count the selected(). Nothing prevents you for throwing that into a selcount method, though
Here is one I wrote ages ago for both desktop and web apps. The desktop side is redundant!
[code]Protected Function getListBoxSelectedCountWAD(myListBox As Object) as Integer
'returns the total number of rows that are selected in the provided ListBox
Dim selectedRows As Integer 'used by Desktop/Web
if myListBox = nil then Return 0
#if TargetDesktop then
Dim tempListBox As ListBox
if myListBox IsA Listbox then tempListBox = ListBox(myListBox)
if tempListBox.ListIndex < 0 then Return 0
for tempInt As Integer = 0 to tempListBox.ListCount - 1
if tempListBox.Selected(tempInt) then selectedRows = selectedRows + 1
next
Return selectedRows
#elseif TargetWeb then
Dim tempWebListBox As WebListBox
if myListBox IsA WebListBox then tempWebListBox = WebListBox(myListBox)
if tempWebListBox.ListIndex < 0 then Return 0
for tempInt As Integer = 0 to tempWebListBox.RowCount - 1
if tempWebListBox.Selected(tempInt) then selectedRows = selectedRows + 1
next
Return selectedRows
#endif
End Function[/code]