Getting error in if statement

i have value in datatable’s Name column and I have taken a name as a input from user.
i want to match the input_name with names in data table which are in second column.
how will I be able to check two values are equal or not

Change if condition to :

row(“Name”).ToString = inputName

1 Like

@Ishan_Shelke Thanks a lot

1 Like

@Ishan_Shelke Greetings of the day

I have one doubt please give me a hint on how to achieve this

if the name matches I want to copy that name’s entire row and paste it into a new sheet.

Sure,

Can you post your datatable screenshot or the excel file which you are picking the data from ?

@Ishan_Shelke

I am taking a input name from user if the name matches with name in data table row
it should copy that entire row and paste it into new sheet .

image

So Say if the input name matches in the if statement so then you can

capture the index by the following function :

yourDatatableVariable.Row.IndexOf(row)

then pass the index variable into the below function :

yourDatatableVariable.Row(index).item(0)+yourDatatableVariable.Row(index).item(1)+yourDatatableVariable.Row(index).item(2)+yourDatatableVariable.Row(index).item(3)+yourDatatableVariable.Row(index).item(3)

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