0

If I create a save a text file, how do I get my application to save it into the end users directory?

Ive current got this which saves into my user area.

file = My.Computer.FileSystem.OpenTextFileWriter("C:\Users\#####\Fruit\Fruit.txt", False)

Thanks

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by BleepyE
Featured Replies
  • [QUOTE=;][/QUOTE] [code] My.Computer.FileSystem.SpecialDirectories.MyDocuments My.Computer.FileSystem.CurrentDirectory [/code] Read More

1
My.Computer.FileSystem.SpecialDirectories.MyDocuments

 My.Computer.FileSystem.CurrentDirectory
0

So if you were to stick that into my code it would be...?

file = My.Computer.FileSystem.SpecialDirectories.MyDocuments("Fruit\Fruit.txt", False)
0

Both are strings of the path.

file = My.Computer.FileSystem.OpenTextFileWriter(My.Computer.FileSystem.SpecialDirectories.MyDocuments, False)

Edited by Unhnd_Exception: n/a

0

And how do i add the file name fruits.txt

file = My.Computer.FileSystem.OpenTextFileWriter(My.Computer.FileSystem.SpecialDirectories.MyDocuments("fruits.txt")

This?

Edited by BleepyE: n/a

0
Dim SavePath as string = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\fruits.txt"

That will give you the path to a file in mydocuments named fuits.txt

If you want to save it in the app directory use the second option that was posted in the first reply. Attach fruits.txt to it the same way

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.