Find key in a dictionary by 2005

Posted on 2010-09-16
Last Modified: 2013-11-07
I need to fnd the keyname in dictionary by index
 For j = 0 To ColCount
DictionaryColumns == keyname at position j

Question by:RIAS
LVL 53

Accepted Solution

Dhaest earned 167 total points
ID: 33690148
What exactly do you want to do, because in a dictonary you can only retrieve the items through the key ?

VB.NET Dictionary Tips and Examples
Module Module1
    Sub Main()
        ' Put four keys into a Dictionary Of String.
        Dim dictionary As New Dictionary(Of String, Integer)
        dictionary.Add("please", 32)
        dictionary.Add("help", 16)
        dictionary.Add("program", 256)
        dictionary.Add("computers", -1)

        ' Loop over entries.
        Dim pair As KeyValuePair(Of String, Integer)
        For Each pair In dictionary
            ' Display Key and Value.
            Console.WriteLine("{0}, {1}", pair.Key, pair.Value)
    End Sub
End Module

Open in new window

LVL 29

Assisted Solution

by:Gautham Janardhan
Gautham Janardhan earned 166 total points
ID: 33690176
wont this do ?
Dim dic As New Dictionary(Of String, String)

        dic.Add("1", "1")
        dic.Add("2", "2")
        dic.Add("3", "3")

        For Each Item As String In dic.Keys

Open in new window


Author Comment

ID: 33690185
Cheers mate will try and get back
LVL 10

Assisted Solution

joriszwaenepoel earned 167 total points
ID: 33690319
       Dim dic As New Dictionary(Of String, String)
       ' ...
        dim theKey = dic.Keys(index)


Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 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