Dim sr as IO.StreamReader=IO.File.OpenText("d:\temp\distance.txt") should read: Dim sr as IO.StreamReader = IO.File.OpenText("c:\temp\distance.txt")