Home All Groups Group Topic Archive Search About

find a users default save location

Author
23 Dec 2006 6:41 PM
Marc
HI,

my program needs to save and write to a file on the users machine. I
dont want to specift a particular location in case it doesnt exist.
whats the best way to search for a user default save location (i.e
documents and settings) in vb,net

Can i search the regsitry? if so whats the code for this?

Many thanks

Marc

Author
23 Dec 2006 7:31 PM
Tom Dacon
I'd use one of these two:

    Application.CommonAppDataPath
    Application.LocalUserAppDataPath

HTH,
Tom Dacon
Dacon Software Consulting

Show quoteHide quote
"Marc" <marc_cro***@hotmail.com> wrote in message
news:1166899277.118177.21030@42g2000cwt.googlegroups.com...
> HI,
>
> my program needs to save and write to a file on the users machine. I
> dont want to specift a particular location in case it doesnt exist.
> whats the best way to search for a user default save location (i.e
> documents and settings) in vb,net
>
> Can i search the regsitry? if so whats the code for this?
>
> Many thanks
>
> Marc
>
Author
24 Dec 2006 3:47 AM
Newbie Coder
Are you talking about the Application Data path or the Internet Explorer
default save location?

To get the application path:

        Dim strAppPath As String =
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToStrin
g
        MessageBox.Show(strAppPath, "Application Data Path")

To get the IE default save location, read the following registry key:

HKEY_USERS\[User's SID]Software\Microsoft\Internet Explorer\Main\Save
Directory

One more thing: SPOOF YOUR E_MAIL ADDRESS IF YOU DON'T WANT TO BE SPAMMED

I hope this helps,

Newbie Coder