Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has in VB6?

Status
Not open for further replies.

tekomni

Programmer
Nov 25, 2002
40
US
Is there a data type of hash in visual basic 6 similar to those in PERL and C++?
 
What kind of data are you trying to store? VB does have a data type called Variant that can be used for most kinds of data.

Thanks and Good Luck!

zemp
 
After looking at what a Hash is in perl, a collection might be what you're looking for in VB. I have never used a hash in C++ before and never learned perl so I am just taking a stab in the dark.
 
Yeah collection seems to be close, but Im not sure how the operation works. A variant is a single variable while a hash is similar to an array, it has a key/value data relationship
 
Collections are key/value as well. You just have to remember to assign the key when you add your item.

Chip H.
 
Got it! Thanks for your help. For anyone who comes across this thread looking for a hash in visual basic use the following sample code:

dim myCol as new collection

myCol.add "password1", "user1"
mycol.add "password2", "user2"

msgbox mycol.item("user2") 'returns password2
 
The dictionary object is actually closer to Perl's Hash object than a collection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top