Denaes Posted August 3, 2004 Posted August 3, 2004 {"Could not find file 'C:\\myStuff\\VS.Net Programming\\C#.Net Programs\\MyProgram\\common run folder\\data.xml'."} XmlDocument dataXML = new XmlDocument(); string path = Application.StartupPath + @"\data.xml"; MessageBox.Show(path); SkillsXML.Load(path); MessageBox.Show shows it properly with only one backslash, but I get that error about the path not existing/can't find file and it shows double backslashes. I know there are issues with strings and regular expressions in C#, but I thought the @ would remove that problem. Apparently I'm not correct. Anyone know a fix for this? Quote
*Experts* Nerseus Posted August 3, 2004 *Experts* Posted August 3, 2004 $10 says the file isn't in that folder, but in your \bin\Debug folder. You're using Application.StartupPath which points to where the EXE is (or your working directory) which is \bin\Debug by default. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Cuffee Posted August 3, 2004 Posted August 3, 2004 slashes did you try it with ? string path = Application.StartupPath + "\\data.xml"; Quote
*Experts* Nerseus Posted August 4, 2004 *Experts* Posted August 4, 2004 @Cuffee: Your solution should be the same as his. You can use the @ to NOT have to double up the backslashes or just double them up. I think he had the file in the wrong place. Bad backslashes usually mean syntax errors - but his MessageBox showed the right path (at least, one that looked "good"). -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Denaes Posted August 5, 2004 Author Posted August 5, 2004 Yeah, I feel stupid. :( I forgot that since I have 3 projects in the solution (the app, a control and a .dll/logic tier), I made a fourth folder for the output of all three when they build. I had put the .xml file inside of the build folder for the application and was thinking my string wasn't working properly. Sorry for the stupid mistake, still getting used to C#. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.