Things You'll Need:
- Visual Basic .NET (any version)
-
Step 1
Add a project reference to the System.Windows.Forms component, if your project doesn't already contain one.
-
Step 2
Add the line "Imports System.Windows.Forms" to the top of the module that will contain the App class.
-
Step 3
Add a public class named App to your module.
-
Step 4
Add two public shared readonly properties, named Path and ExeName, to the App class. Both properties will return an object of type String.
-
Step 5
In the Path getter, add this line of code:
Return System.IO.Path.GetDirectoryName(Application.ExecutablePath) -
Step 6
In the ExeName getter, add this line of code:
Return System.IO.Path.GetFileName(Application.ExecutablePath) -
Step 7
Sample console application calling the App class.The properties App.Path and App.ExeName will now be accessible in your .NET application, and should return the same values as you would have seen in a VB6 application.













