Solved

App.Path in VB.NET?

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

   - Marc
0
Comment
Question by:MarcGraff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Stressed Out?

Watch some penguins on the livecam!

 
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

718 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