Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I have declared string array as this one:

dim array() as string

I have datatable with ID column and I want to convert / add all values from this column to array.

How can I do that?
Posted

Check this[^] out.
 
Share this answer
 
Thank you for your question,

You can try with this:

VB
Dim dr As DataRow, dc As DataColumn

For Each dr In dt.Rows
 For Each dc in dt.Columns
  arr( )( dc.ColumnName() ) = dr( dc )
 Next
Next


Thanks,
Mamun
 
Share this answer
 
Comments
szataniel 2-Aug-11 10:13am    
i get an error:

Number of indices is less than the number of dimensions of the indexed array.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900