Writing to File


Mar 30, 2005
Programming Experience
I have a VB.NET Win App that I want to use to extract data from SQL and write to a file on the users machine in their "My Documents" folder.

1. Can I use Windows Authentication info to create the path to where this file will be saved?
2. Has anyone seen a good example of a StringBuilder class walkthrough that I could use as a starting point for this project?

Thank you, Anthony
1. Environment.GetFolderPath(Environment.SpecialFolder.Personal) should return the path to the current user's "My Documents" folder. .NET 2.0 also includes Environment.SpecialFolder.MyDocuments, which seems to amount to the same thing but is more logically named.

2. The .NET Framework Developer's Guide in the VS.NET help includes a topic called "Using the StringBuilder Class". I haven't used it as I usually only use Append and ToString() with StringBuilders. I entered "StringBuilder" as the search term with Visual Basic as the filter and it was the first topic returned. I'm not sure if you'd get the same result with VB.NET rather than VS.