Solved

Numof of elements in an array

Posted on 2000-05-17
6
344 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 10 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

947 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now