Solved

Visual Basic Associative Array

Posted on 1997-07-09
1
852 Views
Last Modified: 2013-11-25
Is there any built-in or 3rd party Associative Array data (like the one in Java or Perl) type in VB 5? If 3rd party control is available, where can I find it?
0
Comment
Question by:zrokool
[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
1 Comment
 
LVL 3

Accepted Solution

by:
CesarGon earned 50 total points
ID: 1428156
Use collections. Collections are built in VB5, and behave as maps (or associative arrays) from a string to an object. Sample code:

  'create collection and a work variable.
  Dim col as New Collection
  Dim ob as Object

  'create and insert one object into collection.  
  Set ob = New Object
  ob.Prop1 = "Some Text"
  col.Add ob, "First"

  'create and insert another object.  
  Set ob = New Object
  ob.Prop1 = "Some Other Text"
  col.Add ob, "Second"
 
  'retrieve one object.
  Set ob = col("First")

  'directly use object in collection.
  Debug.Print col("Second").Prop1

Ask if you need more info.

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

729 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