Row.item.length compile error


#1

Hi,

I am trying to replace the string in csv if the string in the cell is too long - within a for loop:

I got an compiler error: Option strict on disallow late binding. This is there it goes wrong:

Assign int l = row.Item(6).length\2

I tried it with a string and it works perfectly… divideTwo is a string

Assign int length = divideTwo.length\2

Can someone please help? How to switch to Option strict off? Is it a good practice to turn it off? Thanks!


#2

if you want the i element of the datarow just write row(i).tostring your problem is that you are calling tostring in an object type and you can’t do that in strict mode you should use “to string” before in order to let the compiler know type before execute.


#3

Hi @lavint,

row.Item(6).ToString().length

Regards, Arivu :slight_smile:


#4

Hi @Ignacio_Insua_Feito,
Thanks for your quick reply! Got it. Thanks!


#5

Awesome :smile: thank you!