Your code looks correct, it should work (BTW, you don't need to test if the file exists, the .AppendAllText() method will create the file if it's not there).
The only thing I can think of might be a permissions issue ... I don't know which OS you're running under, but some of them really lock down where you can write files. Perhaps you don't have permission to write a file wherever the Application.StartupPath is. Are you running this from Visual Studio or from the EXE itself? If from the EXE, try right-clicking and "Run As Administrator" and see if that makes a difference.
~~Bonnie DeWitt [C# MVP]
http://geek-goddess-bonnie.blogspot.com
No comments:
Post a Comment