Dela via


My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData Property

Gets a path for storing application data that is shared among all users on the computer.

' Usage
Dim value As String = My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData
' Declaration
Public ReadOnly Property AllUsersApplicationData As String

Property Value

String.

Exceptions

The following condition may cause an exception:

Remarks

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\All Users\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#).

Example

This example displays the path for shared application data in a MessageBox.

MsgBox _
(My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData)

Requirements

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

Permissions

The following permission may be necessary:

Permission

Description

FileIOPermission

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

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

See Also

Reference

My.Computer.FileSystem.SpecialDirectories Object

SpecialDirectories.AllUsersApplicationData