I have a data table that I got from excel and when I’m trying to read the header name and check if it contains a specific value (using this method:" DT.Column(0).ColumnName.Contains(value)") it says that it’s not and when I saw the header name it showed me this Column0
and in my excel file, the header has names like Scenario, NumScenario, ModelCode, etc…
PLEASE HELP ME
thank u
@dlichtenstadt
Do not use contains it will take all the column headers which have scenario word in it, Use either “=” operation or like “scenario” or regex operations
You can use below to get all the column names and store it into an array and then check as explained above
(From dc In dt.Columns.Cast(Of DataColumn)
Select dc.ColumnName).ToArray()
I’m sorry I just saw that my read range is without “add headers”, now its working.
and I don’t have any headers that is a duplicate or contains some of another column…
thank u for the help anyway