Our application needs to write some application specific data, but I have
not been able to find the recommended method to obtain the correct pathname.
I have found many references to the SHGetFolderPath function, but have not
been able to find any way to access this in VB.Net. Apologies in advance if I
have missed something obvious...
I have implemented this in the following function, using the Registry Key
HKEY_CURRENT_USER\Volatile Environment\APPDATA - is this a valid way to
obtain the Application Data Folder?
Protected Function GetApplicationDataFolder() As String
Dim AppDataRegKey As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser.CreateSubKey( "Volatile Environment")
If AppDataRegKey.GetValue("APPDATA") Is Nothing Then
MessageBox.Show("Error: Application Data Path not found",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Else
Return CType(AppDataRegKey.GetValue("APPDATA"), String)
End If
End Function
Thanks for any assistance,
Tim Failes
Advanced User Systems 2 29855
Tim,
You could get a path to user's specific application data folder using:
Environment.GetFolderPath(SpecialFolder.Applicatio nData)
and create a folder there for your application's data.
HTH,
Alexander Shirshov
"Tim Failes" <Ti*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com... Our application needs to write some application specific data, but I have not been able to find the recommended method to obtain the correct pathname.
I have found many references to the SHGetFolderPath function, but have not been able to find any way to access this in VB.Net. Apologies in advance if I have missed something obvious...
I have implemented this in the following function, using the Registry Key HKEY_CURRENT_USER\Volatile Environment\APPDATA - is this a valid way to obtain the Application Data Folder?
Protected Function GetApplicationDataFolder() As String Dim AppDataRegKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey( "Volatile Environment") If AppDataRegKey.GetValue("APPDATA") Is Nothing Then MessageBox.Show("Error: Application Data Path not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Else Return CType(AppDataRegKey.GetValue("APPDATA"), String) End If End Function
Thanks for any assistance, Tim Failes Advanced User Systems
Thank you! I thought there was a better way than what I was doing!
Tim
"Alexander Shirshov" wrote: Tim,
You could get a path to user's specific application data folder using:
Environment.GetFolderPath(SpecialFolder.Applicatio nData)
and create a folder there for your application's data. HTH,
Alexander Shirshov
"Tim Failes" <Ti*******@discussions.microsoft.com> wrote in message news:F3**********************************@microsof t.com... Our application needs to write some application specific data, but I have not been able to find the recommended method to obtain the correct pathname.
I have found many references to the SHGetFolderPath function, but have not been able to find any way to access this in VB.Net. Apologies in advance if I have missed something obvious...
I have implemented this in the following function, using the Registry Key HKEY_CURRENT_USER\Volatile Environment\APPDATA - is this a valid way to obtain the Application Data Folder?
Protected Function GetApplicationDataFolder() As String Dim AppDataRegKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey( "Volatile Environment") If AppDataRegKey.GetValue("APPDATA") Is Nothing Then MessageBox.Show("Error: Application Data Path not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Else Return CType(AppDataRegKey.GetValue("APPDATA"), String) End If End Function
Thanks for any assistance, Tim Failes Advanced User Systems This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tigger |
last post by:
hi
i have a report which i wish to reference from within the program
this is what i am currently using which is fine on my local computer.
crystalReportViewer1.ReportSource = "C:\\\\Documents...
|
by: Dennis C. Drumm |
last post by:
I use the Documents and Settings\All Users\Application Data\AppName folder
to store xml settings that are applicable to all user who log onto a
machine. (The uers personal settings associated with...
|
by: Bry |
last post by:
My code uses System.Environment.GetFolderPath() to determine the
location of the application data folder. This works fine, until I
execute my application using runas, when it is unable to resolve...
|
by: Tim Failes |
last post by:
Our application needs to write some application specific data, but I have
not been able to find the recommended method to obtain the correct pathname.
I have found many references to the...
|
by: Robert |
last post by:
I am developing a Windows service and am in need of storing
a file in the Application Data folder. However, the Service is running
on an "Local System" account and as far as I know that account...
| |
by: Fred W. |
last post by:
I have an application that creates directories in ...\All Users\Application
Data. When I create the directories I need to make sure all users can modify
and add files to them. How do I set...
|
by: Bob |
last post by:
Hi,
How do you get the application folder path that a user select in a msi
install which defaults to c:\Program Files\Company Name\...?
Thanks,
Bob
|
by: vijayB |
last post by:
Hi All,
In windows OS, "program files" folder in windows is protected one, means, only administrator can modify its contents. I having problem with "Documents and settings\All Users\Application...
|
by: babaidebnath |
last post by:
I want to give my application data folder kaspersky antivirus like security. Where I can add a folder but cant change any content or create any file. I even gave the current user full control...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |