Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

11 Experts available now in Live!

Get 1:1 Help Now