# Datatable index

quick question… getting error bout this parameter “B” dt_SMARTDT.Rows.IndexOf(+2)

What are you trying to achieve? Can you explain a bit more

Thanks,
Prankur

2 Likes

Hi

the Syntax would be like
“B”+ (dt_SMARTDT.Rows.IndexOf(datarow)).ToString
Where if we need to add the value we want after two rows from current one
We can mention like this
“B”+ (dt_SMARTDT.Rows.IndexOf(datarow) + 2).ToString

Or
—if we are inside the for each row loop then if we want to use this any range or cell value of write cell then it should be like
“B”+ (dt_SMARTDT.Rows.IndexOf(row) + 2).ToString**

Where row is the variable from the for each row loop that stores the datarow in the current iteration of the loop
Or
If we are not inside the loop then the very first mentioned is the syntax where inside the IndexOf where need to mention the datarow as argument and not the integers

Cheers @julius.mapili