Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Counting controls in a control array in VB6

Is there a way in VB6 to determine how many controls are currently loaded in a control array? I tried using the UBound() function, but it doesn't recognise the control array. (gives error message 'Compile error: Expected array')
Any ideas are appreciated.

Thanks in advance,
Eldin
[313 byte] By [Eldin] at [2007-11-11 8:10:47]
# 1 Re: Counting controls in a control array in VB6
nameOfControlArray.Count

Marco
mstraf at 2007-11-11 17:25:50 >
# 2 Re: Counting controls in a control array in VB6
Thank you very much. I had assumed there was probobly an easy way to do it, but hadn't had much luck in finding it so far.

Eldin
Eldin at 2007-11-11 17:26:50 >
# 3 Re: Counting controls in a control array in VB6
If you want the ubound of the control array, then you use:

nameOfControlArray.upper (or something similar to that in syntax).

But stick with the .Count if you want a count. Since VB Classic lets you define a lower bound, your controls may not start at 0. And you could have gaps too...
edburdo at 2007-11-11 17:27:59 >