Results 1 to 7 of 7

Thread: path

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    path

    I have placed an xml file inside the project.
    In code, how can I access this file without hardcoding the path? Is there a way to just get the file in the same project?
    Thanks

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: path

    You can use this if the file is in the executive folder:
    vb Code:
    1. Dim file As String = My.Application.Info.DirectoryPath & "the file name.xml"
    or this if the file is in the system's specal folder:
    vb Code:
    1. Dim file As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "the file name.xml"

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    Re: path

    I forgot to say that I have placed the xml file inside the class library project as so I can not use Application.
    Any thought please?
    Thanks

  4. #4
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: path

    I don’t understand what you mean the file is going to be in the library project? Can you give a little bit more info? Also, from where do you want to use the file, form the library?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: path

    What does "inside" the project mean? Is this a loose file or is it an embedded resource?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    Re: path

    Settings.xml file is in a project. This project is a class library. From within a class inside the class library project I would like to get the pass of the settings.xml file so that I can use it.
    Thanks

  7. #7

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