?
Solved

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

Posted on 2010-09-16
4
Medium Priority
?
1,920 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
[X]
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
4 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 668 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 664 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 668 total points
ID: 33690319
       Dim dic As New Dictionary(Of String, String)
       ' ...
        dim theKey = dic.Keys(index)

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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