rickbeach08,
Your
test.txt works fine on my PC.
Maybe the problem on your PC is that your System's default text encoding might be different from the .NET Framework's default text-encoding (By default the .NET Framework uses UTF8).
If you notice the
My.Computer.FileSystem.WriteAllText() method has another overload which has 4 parameters. The 4th parameter specifies the text-encoding to be used. If you use the overload with 3 parameters, by default .NET uses UTF8, which is different from that of your system's, your getting the garbage values.
So all you have to do is specify the 4th parameter to that of your system, in the 2nd overload. If you don't know your system's text encoding, just use
System.Text.Encoding.Default as your 4th parameter.
So, your method call will be:
My.Computer.FileSystem.WriteAllText("C:\tmp\test.txt", _
"This is new text to be added.",False,System.Text.Encoding.Default)
Edited by darth_ash, 22 March 2006 - 11:57 PM.