Building String Array from Data Table

So I have an excel file that has one word in each cell of column 1. I am reading that into a Data Table and now I want to add the value of each row to a String Array that I have already initialized. Each row value should be appended to the end of the array.

Is this possible? Should I be using a list? Thanks

@jpreziuso
Working with lists IS more within the Nature of Appending or removing items. Bringing different Things together is also possible. So coming Back to the question on how fetching all row column values into an Array / list. LINQ can Help

YourDataTableVar.asEnumerable.select(Function( r ) r(yourColumnnameOrIndex).ToString.trim).ToList

Is Testing a String list of all columnvalues referenced within the select Statement. With ToArray an Array is created

1 Like

This worked perfectly I believe, thank you. What does the “r” do in this line of code?

@jpreziuso

r is Like a local variable for the Lambda Expression

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.