Solved

Find key in a dictionary by index+vb.net 2005

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

Cheers
0
Comment
Question by:RIAS
4 Comments
 
LVL 53

Accepted Solution

by:
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

http://dotnetperls.com/dictionary-vbnet
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)
        Next
    End Sub
End Module

Open in new window

0
 
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
            MsgBox(Item)
        Next

Open in new window

0
 

Author Comment

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

Assisted Solution

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

0

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 (http://www.microsoft.com/en-us/download/details.aspx?id=27876) 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