Solved

Visual Basic Associative Array

Posted on 1997-07-09
1
833 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
MsgBox 4 75
VB6 ListBox Question 4 61
Zip Folders Using Chilkat Routines 1 85
"Failed to convert parameter value from a String to a Decimal." 4 39
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 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…

738 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