For Web 2.0, does anyone have a working example of how to iterate thru all the webcheckbox’s on a container control and set the value to false? I don’t see any way to create a control set in Web 2.0, so that is out. Also, controlcount seems to be deprecated, so all the old examples won’t work.
Thanks
I think it’s now Lastcontrolindex
Lastcontrolindex looks like it would work. But the docs don’t show how to use it.
Does anyone have an example?
Thanks
Here’s a sample I quickly tossed together:
Public Sub UpdateCheckboxes(c as WebContainer)
var intMax as Integer = c.LastControlIndex
var currentControl as WebControl
var currentCheck as WebCheckbox
for intCycle as Integer = 0 to intMax
currentControl = c.ControlAt(intCycle)
if currentControl isa WebCheckbox then
currentCheck = WebCheckbox( currentControl )
currentCheck.Caption = "Found #" + intCycle.ToString
end if
next
End Sub
Thanks you so much. I will give it try tonight.
This code works as long as the checkboxes are on the container control, but I add a rectangle to the container control and then put the checkboxes in the rectangle and the code no longer works. How do I get to the controls in the rectangle?
Thanks
I’m honestly not sure why this behaves this way, but WebRectangle inherits from WebView (just as WebContainer does), so my assumption was that its children would be accessible in the same way. However, when testing, that doesn’t appear to be the case. Here’s my updated method, but the WebRectangle’s LastControlindex always returns 0.
Public Sub UpdateCheckboxes(c as WebView)
var intMax as Integer = c.LastControlIndex
var currentControl as WebControl
var currentCheck as WebCheckbox
for intCycle as Integer = 0 to intMax
currentControl = c.ControlAt(intCycle)
if currentControl isa WebCheckbox then
currentCheck = WebCheckbox( currentControl )
currentCheck.Caption = "Found #" + intCycle.ToString
elseif currentControl isa WebView then
UpdateCheckboxes( WebView( currentControl ) )
end if
next
End Sub
Thanks for your help.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.