Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

hashtable mutliple parameters to one key

how do i have mutilpe paratemer accosicated to one key

ie

employee 1 key

firstname = somevalue
lastname = some value

employee 2 key

firstname = somevalue
lastname = some value
0
tpiazza55
Asked:
tpiazza55
1 Solution
 
Ravi SinghSenior Software EngineerCommented:
Encapsulate the value part in a class... e.g

        Public Class Name
                Public FirstName As String
                Public SecondName As String
        End Class

Then you can create instances of it and store the instance in the hashtables value part:

        Dim HT As New Hashtable

        'Create a name object
        Dim Name1 As New Name
        Name1.FirstName = "John"
        Name1.SecondName = "Doe"

        'Store in hashtable
        HT.Add("key", Name1)

        'Retrieve the name object
        Dim Name2 As Name = HT("key")
        Dim FirstName As String = Name2.FirstName
        Dim SecondName As String = Name2.SecondName

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now