-
Apr 5th, 2014, 06:55 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Accessing public documents folder in code
Hello
I have this code working to place a file in the my documents folder in any version (I hope) of the o/s
Public Class Form1 'test file access
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim filePath As String
filePath = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "test.txt")
My.Computer.FileSystem.WriteAllText(filePath, "some text", False)
Catch fileException As Exception
Throw fileException
End Try
End Sub
End Class
I would like to access the *public* documents file via the SpecialDirectories statement and am so far failing to do it.
In VB6 I could access the public documents file by
GetSpecialFolder(CSIDL_COMMON_DOCUMENTS)
-
Apr 5th, 2014, 08:37 PM
#2
Re: Accessing public documents folder in code
Try the Environment.GetFolderPath method. You can specify CommonDocuments as the folder whose path to get.
-
Apr 5th, 2014, 09:04 PM
#3
Thread Starter
Frenzied Member
Re: Accessing public documents folder in code
... and although we mutually ignored each other, that is just what I did and was about to mark the thread resolved. BTW, your explanation still far too terse for my tiny mind, but I found it anyway and have
'aPath is my allocated string variable
aPath = Environment.GetFolderPath(Environment.SpecialFol der.CommonDocuments)
-
Apr 5th, 2014, 10:14 PM
#4
Re: Accessing public documents folder in code
I guess some impediments simply cannot be overcome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|