CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    114

    Question App.path in .net

    there was App.path in vb6 to indicate the application folder..how to do this in vb.net???

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: App.path in .net

    Quote Originally Posted by shuvo
    there was App.path in vb6 to indicate the application folder..how to do this in vb.net???
    System.Reflection.Assembly.GetExecutingAssembly.Location --> This will give you the whole path including the exe name..

    There is no App object present in .NET so you will have to look through MSDN to find out wat are the different equivalents of App object...

  3. #3
    Join Date
    Sep 2002
    Location
    Mumbai
    Posts
    98

    Re: App.path in .net

    Application.StartupPath

    This gives the path of Application Executable excluding the exe file name.

    Hope this helps.

  4. #4
    Join Date
    Mar 2004
    Posts
    114

    Re: App.path in .net

    U can get the name of the executable file by your defined code..but it is not useful when u want to open a file like a Dat file or Txt file then u will need the specific address string like we used to get App.path\text.txt.How do I get that?

  5. #5
    Join Date
    Sep 2002
    Location
    Mumbai
    Posts
    98

    Re: App.path in .net

    Application.StartupPath & "\text.txt".

    This will give you the file from the apllication folder i.e. BIN folder.

    See EXCLUDING in last reply

  6. #6
    Join Date
    Mar 2004
    Posts
    114

    Re: App.path in .net

    yes Amit...I didn't see ur Reply before my last reply...ur solution solved my problem..thanx a lot.

  7. #7
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: App.path in .net

    When constructing PATH, use System.IO.Path.Combine() method.
    Good Luck,
    -Cool Bizs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured