Solved

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

Posted on 2010-09-16
4
1,795 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

23 Experts available now in Live!

Get 1:1 Help Now