I am attempting to read in the contents of a textfile into a textbox.
TextFile = My.Computer.FileSystem.ReadAllText("c:\Temp\Checks.txt")
This text file is written by another application and for some strange reason the text actually starts on line 2 of the text file. The file can't be read by the above method and it seems because there is some kind of unseen character at the start of the first line.
I found this by accident by placing the mouse curser at the start of the first line in the textfile and pressing "delete" on the keyboard. By saving the text file, the contents can now be read in using the above method - nothing appearing on the first line, but all the contents of the file now read into the text box.
I tried using a "StreamReader" to "ReadToEnd" with exactly the same result. What could be the reason that deleteing the first "invisible" character at the beginning of the text file allows the file to be read and more importantly how do I fix the text file prior to reading it's contents? :confused:
TextFile = My.Computer.FileSystem.ReadAllText("c:\Temp\Checks.txt")
This text file is written by another application and for some strange reason the text actually starts on line 2 of the text file. The file can't be read by the above method and it seems because there is some kind of unseen character at the start of the first line.
I found this by accident by placing the mouse curser at the start of the first line in the textfile and pressing "delete" on the keyboard. By saving the text file, the contents can now be read in using the above method - nothing appearing on the first line, but all the contents of the file now read into the text box.
I tried using a "StreamReader" to "ReadToEnd" with exactly the same result. What could be the reason that deleteing the first "invisible" character at the beginning of the text file allows the file to be read and more importantly how do I fix the text file prior to reading it's contents? :confused: