Gets a path for storing the current user's application data.
' Usage
Dim value As String = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
' Declaration
Public ReadOnly Property CurrentUserApplicationData As String
String.
The following condition may cause an exception:
The My.Computer.FileSystem.SpecialDirectories Object contains paths to commonly referenced directories.
If the path does not exist, it is created with the following format: BasePath\CompanyName\ProductName\Version
A typical BasePath in Windows XP is C:\Documents and Settings\username\Application Data. The CompanyName, ProductName, and Version can be obtained from the My.Application.Info.CompanyName, My.Application.Info.ProductName, and My.Application.Info.Version properties.
Note: |
|---|
If the
Company and Product names are not specified in the Assembly Information dialog box, the CompanyName\ProductName in the path are replaced with the assembly name. For more information on setting assembly information names, see How to: Specify Assembly Information (Visual Basic, C#).
|
Data stored in this path is part of a user profile that is enabled for roaming. A roaming user works on more than one computer in a network. The user profile for a roaming user is kept on a server on the network and is loaded onto a system when the user logs on. For a user profile to be eligible for roaming, the operating system must support roaming profiles and the feature must be enabled.
This example displays the path for storing the current user's application data in a MessageBox.
MsgBox(My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
Namespace: Microsoft.VisualBasic.MyServices
Class: SpecialDirectoriesProxy (provides access to SpecialDirectories)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type
|
Available
|
|---|
Windows Application
|
Yes
|
Class Library
|
Yes
|
Console Application
|
Yes
|
Windows Control Library
|
Yes
|
Web Control Library
|
Yes
|
Windows Service
|
Yes
|
Web Site
|
Yes
|
The following permission is required:
For more information, see Code Access Security and Requesting Permissions.
Reference