Results 1 to 5 of 5

Thread: [RESOLVED] [VB.net] Referring to files within the project folder

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    8

    Resolved [RESOLVED] [VB.net] Referring to files within the project folder

    If I was using code to refer to a file's location say "E:\files\1.doc" is there a way I can copy that 1.doc into the project folder and code it so the program will find it no matter where the project folder is without having to add the document as a resource...

    I know when referring to databases you can use -

    Dim ConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Users.mdb"

    The part I suspect I need being -

    |DataDirectory|\Users.mdb"

    Thanks for any help, Robin

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [VB.net] Referring to files within the project folder

    Application.StartUpPath will give you the path you need.
    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)

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    8

    Re: [VB.net] Referring to files within the project folder

    And that will let me refer to items in the project folder if i move the project folder from my E: drive to C: drive?

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [VB.net] Referring to files within the project folder

    It will return the folder where your EXE is located, wherever it may be.
    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

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    8

    Re: [VB.net] Referring to files within the project folder

    Ok thanks a lot! Working now cheers.

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