IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
VB.Net
Search VB.Net Group:

Advanced
-Collapse +Expand VB.Net To/From
To/FromCODEGuides
-Collapse +Expand VB.Net Store
PRESTWOODSTORE

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingVB.NetLanguage Basics   Print This    All Groups  
  From the August 2014 Issue of Prestwood eMag
 
VB.Net Language Basics:
Associative Arrays in Visual Basic (a Dictionary)
 
Posted 13 years ago on 6/19/2008 and updated 11/9/2008
VB.Net Code Snippet:
 A flashcard from our VB.Net Flashcards Library
 A code snippet from our VB.Net Code Snippets Page

KB101220

An associative array links a set of keys to a set of values. In Visual Basic, associative arrays are implemented as Dictionaries.

This code produces a message box saying "Nevada."

Syntax Example:
Imports System.Collections.Generic

Protected Sub Button1_Click(ByVal sender As Object,
              ByVal e As System.EventArgs) Handles Button1.Click
        Dim States As New Dictionary(Of String, String)

        States.Add("CA", "California")
        States.Add("NV", "Nevada")
        States.Add("OR", "Oregon")
        MsgBox(States("NV"))
End Sub

More Info

Code:  Assocative Arrays in ObjectPAL
Definition:  Associative Array
FAQ:  Associative Arrays in ASP Classic
Tip:  Associative Arrays in Delphi/Object Pascal
Code:  Associative Arrays in Delphi/Object Pascal (Use TStringList)

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1156A1
Enter key:
Code Contributed By Stephen Berry:
Visit Profile

 KB Article #101220 Counter
24492
Since 6/19/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]