How to filter data table with index

Hey there! Do you know how to filter data table with index of a Column

@Enzo_Rossetti
give a try on DataTableVar.Columns(YourIndex).ColumnName

1 Like

That’s the point, I don’t have a column name. In this case 17 is column"R"

In case that Data table found (For example) “Swire1234”, i must to keep that row, but if it doesn’t contain swire or 9 characters, remove.

Fine
We can just mention the index alone like how you have mention in the second one
17 contains “swire”

Similarly mention as
17 contains “9”

That would work for sure
Cheers @Enzo_Rossetti

@Enzo_Rossetti
I didn’t get you. A dataTable should always have a columnname. With the statement from above you dont need to know the name as it is retrieved with referenced by index.

From where is the datatable coming / created. Can you elaborate more on your requirement?

as mentioned by @Palaniyappan ColumnIndex can be used and schould work
a construct of testing if Column(17) has a value length of 9 characters (I do interpretate your screenshot from above in this way) is maybe the compiling error issue

For such cases LINQ is one of alternate options