Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Numof of elements in an array

Posted on 2000-05-17
6
Medium Priority
?
364 Views
Last Modified: 2011-09-20
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
Comment
Question by:tomhoran
  • 2
  • 2
  • 2
6 Comments
 

Author Comment

by:tomhoran
ID: 2819715
Adjusted points from 5 to 10
0
 
LVL 9

Accepted Solution

by:
GivenRandy earned 40 total points
ID: 2819718
UBound(WkKey) - LBound(WkKey) + 1
0
 
LVL 1

Expert Comment

by:pauljk
ID: 2819721
ubound(WkKey) + 1

This will give you the count of occurences.
+1 becuase it starts at 0.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:pauljk
ID: 2819725
Beware...  You will get an error if you do not have any elements in your array.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2819736
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
 

Author Comment

by:tomhoran
ID: 2819744
Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question