My.Application.Info.DirectoryPath Property 

Gets the directory where the application is stored.

' Usage
Dim value As String = My.Application.Info.DirectoryPath
' Declaration
Public ReadOnly Property DirectoryPath As String

Return Value

A String that contains the directory where the application is stored.

Remarks

The My.Application.Info.DirectoryPath property gets the directory where the application is stored.

Example

This example uses the My.Application.Info.DirectoryPath property to display the directory path where the application is stored.

MsgBox("Application directory path: " & My.Application.Info.DirectoryPath)

Requirements

Namespace: Microsoft.VisualBasic.ApplicationServices

Class: AssemblyInfo

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

No

Windows Service

Yes

Web Site

No

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.Application.Info Object
Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.DirectoryPath