Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

829 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