Where’s my app.path in vb.net

Where’s my App.Path in VB.NET?

ID: 1064
Author: Abstractvb.com
Date: 9/15/2002 12:59:10 PM
VB.NET

Description

The APP Object no longer exists in VB.NET, so calling App.Path to get the location of your application does not work. Thankfully there are many other ways to do this in VB.NET, here are a few.

NOTE: Some of these will only work for forms and not DLL’s without any UI. The first two that reference the System.Windows.Forms namespace will not work in a DLL with no UI.

Code

Here are a few examples: (I’m sure there are more.)

System.Windows.Forms.Application.ExecutablePath
System.Windows.Forms.Application.StartupPath
System.AppDomain.CurrentDomain.BaseDirectory()
System.GetEntryAssembly().Location

답글 남기기