Skip to content

Trying to load an xml document in my windows forms application

Doug

Asked Mar 18, 2009, 12:40 PM EDT1 answer
Share
LinkedInX
I've got a folder named "Configuration" in my windows form application. In that folder I have an xml file named "Exercises.xml". I'm trying to load this file into an XDocument with this line here: XDocument exerciseXML = XDocument.Load("~/Configuration/Exercise.xml"); When I test the program, I'm getting an error: Message="Could not find a part of the path 'C:\\VS2008_Projects\\ExerciseTracker\\ExerciseTracker\\bin\\Debug\\Configuration\\Exercise.xml'. How am I suppposed to reference the file in my load method??

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    Application.StartupPath + [The name of your xml file]
    0