Solved

App.Path in VB.NET?

Posted on 2003-12-11
6
1,471 Views
Last Modified: 2007-12-19
What is App.Path in VB.NET?

   - Marc
0
Comment
Question by:MarcGraff
6 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 125 total points
ID: 9921871
System.Windows.Forms.Application.ExecutablePath
System.Windows.Forms.Application.StartupPath
System.AppDomain.CurrentDomain.BaseDirectory()
System.GetEntryAssembly().Location
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9921876
Public Function App_Path() As String
        Return System.AppDomain.CurrentDomain.BaseDirectory()
    End Function

these are a couple ways
0
 
LVL 8

Expert Comment

by:Dranizz
ID: 9921879
System.GetEntryAssembly().Location
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 48

Expert Comment

by:Mikal613
ID: 9921885
Option Explicit
    Option Strict
    Imports System
    Imports System.IO
    Class ThisApp
          Private mAppPath As String
          Private mExeName As String
          Public ReadOnly Property AppPath() As String
                Get
                      Return mAppPath
                End Get
          End Property
          Public ReadOnly Property ExeName() As String
                Get
                      Return mExeName
                End Get
          End Property
          Public Sub New()
                Dim p As Path
                Try
                      mAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location
                      mExeName = Dir(mAppPath)
                      mAppPath = p.GetFullPath((Left(mAppPath, (Len(mAppPath) - Len(mExeName)))))
                Catch
                      MsgBox(Err.Description, MsgBoxStyle.Critical, "Error!")
                End Try
          End Sub
    End Class
    Module modMain
          Sub Main()
                Dim MyApp As ThisApp = New ThisApp()
                MsgBox(MyApp.AppPath, MsgBoxStyle.Information, "App Path")
                MsgBox(MyApp.ExeName, MsgBoxStyle.Information, "Exe Name")
          End Sub
    End Module

0
 

Expert Comment

by:samdotnet
ID: 9926807
Its I simply Application.StartupPath, in .net if you don’t specify the path then the file will be saved in your bin folder
Other than this there are lots of cool properties and methods that you can find in Application class
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9927986
Thank you very much!

   - Marc
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web Form VB.Net  import CSV 4 36
Modal Popup Extender control 1 20
Call windows 10 virtual keyboard from windows forms app 2 34
JSON  parse help 7 24
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question