|
-
Apr 14th, 2017, 02:55 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Find out how many labels are in a label array?
Hi there folks!
Would anyone know about Ubound, and if it could tell me how many labels are in a label array? It doesn't matter if it has text in the label caption or not.
My label array is called lblWordLetter, so I tried...
Dim nElements As Long
nElements = UBound(lblWordLetter) - LBound(lblWordLetter) + 1
MsgBox nElements
The problem is I get an error saying "array", and it highlights the word UBound in the code above.
Where did I go wrong? : )
Thanks!
-
Apr 14th, 2017, 03:16 PM
#2
Re: Find out how many labels are in a label array?
It is:
Code:
nElements = lblWordLetter.Ubound
-
Apr 14th, 2017, 03:19 PM
#3
Re: Find out how many labels are in a label array?
-
Apr 14th, 2017, 04:24 PM
#4
Re: Find out how many labels are in a label array?
lblWordLetter.UBound will give you the highest Index in the Array; lblWordLetter.Count will give you the number of elements actually in the Array. This is significant because Control Arrays may not be continuous.
e.g. you can have a lblWordLetter(0), lblWordLetter(2), lblWordLetter(3) without a lblWordLetter(1)
-
Apr 14th, 2017, 04:24 PM
#5
Re: Find out how many labels are in a label array?
-
Apr 14th, 2017, 06:08 PM
#6
Thread Starter
PowerPoster
Re: Find out how many labels are in a label array?
Thank you! You have all been very helpful!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|