Maybe try to change you loop to a
while
loop:
While (Not String.IsNullOrEmpty(row = sr.ReadLine()))
End While
A
Do..Until
loop only performs the test when the
Until
statement is reached; at this point, loop contents have already been executed, and there is a big chance to get a
NullReferenceException
if the assignation at the beginning of the loop lead to a null value.
Whereas a
While
loop performs this test at the very beginning.