I have a problem with an application I have written. To keep it simple, it does heavy math calculations. If the results meet a specific criteria, it is written to a text file on a line-line-basis.

The problems is, if I go look at the data files, I will find non-numeric symbols mixed in with the numbers. Sometimes it is a question mark, "?". Other times, it is control or extended characters that Notepad or Wordpad cannot display. They can be mixed into the numbers, like so: 215x7 or 8948x, where "x" is the odd character. I thought the problem may have been my use of "DataFile.Flush". I removed that, but still have the corruption.

Below are my declarations and code fragments:

Code:
Dim Number as ULong
Dim DataFile As System.IO.StreamWriter

DataFile = My.Computer.FileSystem.OpenTextFileWriter(FilePath & fName, False)

DataFile.WriteLine(Number)
The first time I had a problem, I thought it was my use of "Cstr()" in the WriteLine statement, with "Flush" as I stated above.

I do not know if this is a situation internal to VB2008, or external, like hard drive buffers writing.