|
-
May 11th, 2016, 10:04 AM
#1
Trying to understand Collections
Hi Guys,
After being admonished yet again by jmcilhinney I'm trying to understand Collections.
I can use the code: -
Code:
Dim Col1 As New Microsoft.VisualBasic.Collection()
without much of a problem.
But now I'm trying to use 'Pairs' of data. Collection as above will accept a pair of data, but I can't find how to retrieve both.
So I looked at: -
Code:
Dim Col2 As New Hashtable()
Which it seems is more designed towards 'Pairs', but again, I can submit a pair of data and they're accepted, but again I can't find how to retrieve 'em.
Setting a breakpoint after adding a pair of data to either type of collection I can see in the 'Locals' window that both data are there, in my case they're listed as 'Key' and 'Value' although the 'key' is an integer and the 'Value' is a string... They're listed as such, so something must be right.
So I'm asking how to retrieve both data, I can only retrieve the 'Key' at the moment.
With a string data and an integer data in Col1 and using : -
Code:
Dat1 = Col1.Item(1)
For example will put the 'String' into the string variable Dat1.
I tried: -
But that failed at runtime... Dat2 as an Int32 was the wrong variable type. I thought maybe it was cleaver and know which data type I was asking for, I did wonder what would happen in that case if both data types were the same.
I tried the same with Col2 with the same result.
Poppa.
Along with the sunshine there has to be a little rain sometime.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|