Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Are VB6 custom collections zero-based or one-based???

Posted on 2009-07-01
3
Medium Priority
?
1,175 Views
Last Modified: 2013-11-25
Hi gang,

I'm working on a VB6 legacy app at my client and I haven't touched VB6 in about 9 years. I am using a custom collection to store instances of a custom object I created. I had no problem adding objects to the collection. My question is, when referring to one of n objects in the collection,  are the positions 1-to-n (one to n) or 0-to-(n-1). They appear to be one-based because I am getting subscript out of range errors, but I thought I would run it by you guys to find out if I am missing something.

Best regards,
Kevin
0
Comment
Question by:KMcElhiney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 total points
ID: 24756917
use lbound(  array ) and ubound( array )
for collections, they are 1-based.
0
 

Author Comment

by:KMcElhiney
ID: 24757061
Thanks for the reply. I found another reference that says that VB6 collections are indeed one-based:
http://articles.techrepublic.com.com/5100-10878_11-5800272.html
However, collections are not arrays and do not support the ubound and lbound functions. Since you replied so quickly, I'll accept your comment as the solution.
0
 

Author Closing Comment

by:KMcElhiney
ID: 31598887
VB6 Collections are one-based. They have only one property, i.e. Count. The UBound and LBound functions do not work on collections, only on arrays.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

610 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