Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

Numof of elements in an array

In visual basic 6, how do i tell how many elements are in an array?

Private Function GetData(TblKey As String)

Dim WkKey As Variant
WkKey = Split(TblKey, ",")

How can i tell how many elements or occurences are in WkKey?
0
tomhoran
Asked:
tomhoran
  • 2
  • 2
  • 2
1 Solution
 
tomhoranAuthor Commented:
Adjusted points from 5 to 10
0
 
GivenRandyCommented:
UBound(WkKey) - LBound(WkKey) + 1
0
 
pauljkCommented:
ubound(WkKey) + 1

This will give you the count of occurences.
+1 becuase it starts at 0.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
pauljkCommented:
Beware...  You will get an error if you do not have any elements in your array.
0
 
GivenRandyCommented:
Pauljk, my solution is more complete and before yours was submitted.  Why did you set yours as the proposed answer?  Well, hopefully tomhoran notices this.  
0
 
tomhoranAuthor Commented:
Thanks.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now