Solved

hashtable mutliple parameters to one key

Posted on 2006-06-13
3
183 Views
Last Modified: 2010-04-23
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
Comment
Question by:tpiazza55
3 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 50 total points
ID: 16895538
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now