Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Basic
 CurrentUserApplicationData Property...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Basic Language Reference
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData Property

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.

NoteNote:

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.

Visual Basic
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:

Permission

Description

FileIOPermission

Controls the ability to access files and folders. Associated enumeration: Unrestricted.

For more information, see Code Access Security and Requesting Permissions.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker