Results 1 to 10 of 10

Thread: [Resolved] .NET newbie has an easy question

  1. #1

    Thread Starter
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    [Resolved] .NET newbie has an easy question

    Hello! Ive just switched from VB 6 to .Net and i feel like a complete stranger to VB at the moment

    In VB6 u could write app.path to retrieve the apps path.. but what to write in .Net ? Cheers
    Last edited by Atheist; Dec 16th, 2005 at 10:08 AM.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: .NET newbie has an easy question

    VB Code:
    1. Application.StartupPath

  3. #3
    Addicted Member BobTheBuilder.'s Avatar
    Join Date
    Apr 2005
    Location
    Ohio
    Posts
    149

    Re: .NET newbie has an easy question

    Try:

    VB Code:
    1. Application.StartupPath

  4. #4

    Thread Starter
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: .NET newbie has an easy question

    aah thx guys!
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: .NET newbie has an easy question

    If your thread is resolved, you can go to the top under "thread tools" and mark it as "resolved"

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: .NET newbie has an easy question

    If it's not resolved, you can throw a box of apple juice at gigemboy.

  7. #7
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: .NET newbie has an easy question

    mmm.. apple juice.... my favorite

  8. #8
    Lively Member
    Join Date
    Nov 2005
    Posts
    71

    Re: .NET newbie has an easy question

    this wud also work and it is also sometimes better
    VB Code:
    1. Environment.CurrentDirectory
    but the reason why it's better is becuase you can do stuff like
    VB Code:
    1. Environment.MachineName
    2. Environment.OSVersion
    3. Environment.UserName

    and it get's better for stuff like desktop folder
    VB Code:
    1. Environment.SpecialFolder.Desktop()
    2. Environment.SpecialFolder.Favorites()
    3. Environment.SpecialFolder.MyComputer()
    4. Environment.SpecialFolder.MyDocuments()

    it's pretty cool and i would recomend it

  9. #9
    Frenzied Member conipto's Avatar
    Join Date
    Jun 2005
    Location
    Chicago
    Posts
    1,175

    Re: .NET newbie has an easy question

    Environment.CurrentDirectory is almost always a BAD choice in this circumstance. Other applications can change the current directory.

    Bill
    Hate Adobe Acrobat? My Codebank Sumbissions - Easy CodeDom Expression evaluator: (VB / C# ) -- C# Scrolling Text Display

    I Like to code when drunk. Don't say you weren't warned.

  10. #10
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: .NET newbie has an easy question

    Yes sir, conipto is correct. Environment.Currentdirectory will not always return the application directory in ever instance. It is a windows system variable, and this can change depending on the other programs you have running as well. I was using Environment.Currentdirectory in some of my early programs and started getting errors when working with other programs as well, it would return some other directory that I had chosen in a file save dialog or what not in a different program. So, stick with application.startuppath...

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