Opened a new thread on this since it’s not specific to Web use.
In trying to debug the cause of the NOE when accessing my Control Arrays, I simply tried to loop through the Text values of the members. As soon as I tried to access array member 1, I get an NOE. I then tried to get the Ubound for the Control Array to only step through the existing members but Ubound is not an option …
I know I’ve been living in Visual Studio and XCode for the last 4 months, but, no Ubound on a Control Array?
Yes, you don’t have a ubound for Control Sets. You need to keep a count of members yourself when you add or remove them. I don’t know about your NOE, but check it’s of the type you want with ISA and then if it is, cast accordingly.
Thanks, Richard, but the reason that I was trying the Ubound trick was because my array of 5 controls (0-4) is throwing an NOE as soon as I stepped from 0 to 1. Basically:
For x = 0 To 4
MemCheck = MemCheck + Val(pmCount(x).Text)
Next
Accessing 0 is good, but as soon as x becomes 1, poof - NOE.
It turns out that if the members of the control set (thanks, Tim) aren’t visible, they don’t exist. If I keep track of how many rows are visible, the logic works …
Usually, the way to replace the missing UBound function was to use a code like this:
var i as integer
do
try
var cnt as MyControlArray=MyControlArray(i)
catch
return i
end try
i=i+1
loop
(sorry for possible bugs, I don’t remember well; it was months/years ago that I needed this)
This is no longer doable in Xojo because the order/hole-free is not guaranteed anymore?
This will fail on Control Sets with holes in them. According to Tim, making a control invisible creates a hole. Removing an item also leaves a hole. Control Sets are not arrays and that is covered in the documentation I linked.