Solved

App.Path in VB.NET?

Posted on 2003-12-11
6
1,466 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now