I understand For Each ctl As WebUIControl In Controls iterates through all controls in a container, but I want to process them in a specific order,
I’ve managed to build an array of webcontrol.controlIDs sorted by tab order…
var CtlID(999) as String
var i as Integer = 0
For Each ctl As WebUIControl In Controls
CtlID(ctl.TabIndex) = ctl.ControlID
i = max(i,ctl.TabIndex)
Next
How can I loop through the array processing each control in the taborder?
I’ve built the array, but I can’t work out how to interate through it. All the examples I can find use:
For Each ctl As WebUIControl In Controls
I want/need
var CtlID(999) as String
var i as Integer = 0
For Each ctl As WebUIControl In Controls
CtlID(ctl.TabIndex) = ctl.ControlID
i = max(i,ctl.TabIndex)
Next
For j = 0 to i 'i = highest tabindex
reference the control by CtlID(j)
next
Public Function ControlTabIndexOrder(c1 As WebUIControl, c2 As WebUIControl) As Integer
If c1.TabIndex > c2.TabIndex Then Return 1
If c1.TabIndex < c2.TabIndex Then Return -1
return 0
End Function
Sub Pressed() Handles Pressed
Var list() As WebUIControl
list.RemoveAll
For Each ctl As WebUIControl In Controls
list.Add(ctl)
System.DebugLog ctl.TabIndex.ToString
Next
System.DebugLog "Sort"
list.Sort(AddressOf ControlTabIndexOrder)
For Each ctl As WebUIControl In list
System.DebugLog ctl.TabIndex.ToString
If ctl IsA WebCheckbox Then
Var check As WebCheckbox = WebCheckbox(ctl)
System.DebugLog check.Value.ToString
End If
Next
End Sub