Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Visual Basic: Converting from DataTable to List

My DataTable has two columns (Integer, String)

And I need to convert that entire DataTable into a single list.

What is the VB syntax for this?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

What do you want the List to be? A List(Of String), where you combine the two columns to become one string or a List(Of SomeClass) where the class has two properties?
Avatar of curiouswebster

ASKER

I guess I want a dictionary:

Integer, String
Hi newbieweb;

Every key in a Dictionary(Of TKey, TValue) must be unique. Which will be the Key the column with the Integer or the column with the String data type?
key (integer) is unique
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi newbiweb;

A Dictionary object does NOT maintain an index into its collection and therefor does not have an index. You may want to use a different collection if you need indexing.
Thanks!
Not a problem newbieweb, glad I was able to help.