When an error occurs, it should take you to the line that threw the error. Is that not happening?

I would guess that your error is right here:

(dt.Rows(0)(x))

Shouldn't that be dt2?