Read Column

I wanted to read column like read row. When we use row(0) it reads all the value in row 0. Can anybody help me to read a column like a row.

@Aman_Mongar1,

I assume you have a datatable named as yourDataTable,

yourDataTable.AsEnumerable().[Select](Function(row) row.Field(Of String)("ColumnName")).ToArray()

This will give you string array of the column as you want.

If you need like row(0), then try the following,

yourDataTable.Columns(0)

This will give you a datacolumn.

Mention why you need to read the column like that, any specific reason, we may have alternate solution.

1 Like

I tried ```
yourDataTable.Columns(0)

its not looping

@Aman_Mongar1,

Check the xaml, I am using DataColumn as the parameter in a for each loop and able to get datacolumn properties.

Test.xaml (4.9 KB)