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
Printable View
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
You can use this if the file is in the executive folder:
or this if the file is in the system's specal folder:vb Code:
Dim file As String = My.Application.Info.DirectoryPath & "the file name.xml"
vb Code:
Dim file As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "the file name.xml"
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
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?
What does "inside" the project mean? Is this a loose file or is it an embedded resource?
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
Duplicate thread:
http://www.vbforums.com/showthread.php?t=536373