How to validate if column name's value start from the column name itself

Hi, I want to validate if values of columns starting from column name itself. Say suppose I have diffirent column names like A, D, R etc. and their values like A1, D1, R1. So I want to validate that value of respective column are exactly below of their column.
For Ex.


In above Image, the values of respective columns are exactly starting from column name itself. If it is not then it should throw an error.

Check the inputstring.startswith(column name) inside for each of column

Thanks for the reply Sangeetha. Let me try with this way

Hi,

If you need just validation result (True or False) the following condition will work.

dt.AsEnumerable.All(Function(r) dt.Columns.Cast(Of DataColumn).All(Function(dc) r(dc.ColumnName).ToString.StartsWith(dc.ColumnName)))

Regards,

1 Like

Thanks Yoichi, Will try this one also.

Main.xaml (14.0 KB) @Rohit_Patil1

1 Like

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