Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
|
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2008, 06:47 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default How to find paths in visual C#?

Hi

I am making an xml comment file with the help of sandCastle and help file builder.

when I am finished my project I want to include it into my program. So when the user loads up my windows application there is a on the menu strip a button they click that loads up this documentation.chm file.

So in my project I made a separate folder called "documentation" and put my file in there. Now I want to use Process.Start() to open up that file.

However I don't know how to get the relative path for that documentation since I know hardcover the path in won't work once I move of my computer.

I only can find stuff to find the bin directory and stuff like that.

Thanks

 
Old September 17th, 2008, 05:34 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can typically get away with using a path relative to the application's runtime directory, the bin folder. So if you have a documentation folder next to the bin folder, this should work: "..\documentation\helpfile.chm".

-Peter
compiledthoughts.com
 
Old September 25th, 2008, 11:12 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

Peter's given you the correct info. Because the executable for a C# program resides in the bin folder for the application, a call to:

GetCurrentDirectory()

will return a string that gives you the current working directory for the application. It would be a simple thing to place your doc folder off this (bin) working directory.

Dr. Purdum


Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)





Similar Threads
Thread Thread Starter Forum Replies Last Post
not all code paths return a value galua SQL Language 11 January 20th, 2008 09:36 PM
I can't find visual c++ 6.0 can I use this ratemyexperience Pro Visual Basic 2005 1 December 22nd, 2007 09:07 PM
paths table FT BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:50 AM
How can I find the answers to Beginning Visual C# gqzou Wrox Book Feedback 8 November 11th, 2004 02:16 PM
HELP with relative paths in FileSystemObject stalker Javascript 5 September 4th, 2003 02:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.