50 pts.
 How do I find the file path to write my file to?
Here is my code and then my question. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objfile As New System.IO.StreamWriter("C:Documents and SettingsJOHNDOEMy DocumentsTHETARGETFOLDERMYFILE.TXT") objfile.WriteLine("just a test") objfile.Close() end sub This code will write to my target folder, however if i build my project and make it available for other people to use on their computer I run into the problem of not knowing what the john doe name is. How would i know what they have named their computer. Is there a way around this. any suggestions? -vb 2008

Software/Hardware used:
ASKED: December 12, 2008  11:51 PM
UPDATED: December 15, 2008  7:26 PM

Answer Wiki:
There's a couple ways to get around this problem: 1. You can use windows system variables instead of hard-coding the path into your app. For example: Save my file to "%HOMEPATH%My DocumentsMyFile.txt" 2. Prompt the user where they want to save the file and save that in a configuration/ini file in your app's folder. 3. Save the file to your app's folder by using the .Net variable Application.StartupPath, which refers to your application's folder. - Max
Last Wiki Answer Submitted:  December 14, 2008  2:53 pm  by  Max99   35 pts.
All Answer Wiki Contributors:  Max99   35 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _