vb.net - IndexOutOfRangeException - Reading through a file -


so trying read through file , have index set counter can move character character in file find index °s at. keep getting indexoutofrangeexception though have no clue wrong.

 dim chr string     dim c1 string     dim c2 string     dim c3 string     static index integer = -1     index += 1     chr = numdat(index)      while asc(chr) <> 176         index += 1         chr = numdat(index)     end while 

i getting error @ index in chr = numdat(index). appreciated, thanks!

edit: forgot mention numdat string has read in whole file already.

numdat = my.computer.filesystem.readalltext(path + filename) 

you can find occurrences of ° this:

numdat = my.computer.filesystem.readalltext(path + filename) dim index integer = numdat.indexof("°") while index <> -1     debug.print(index)     index = numdat.indexof("°", index + 1) end while 

Comments