For Programmers: Free Programming Magazines  


Home > Archive > C# > March 2004 > Relative path









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Relative path
Shahar

2004-03-28, 10:28 pm

Hi
I'm using the OpenFileDialog object to open some file, can I know the
relative path to my assembly ?

i.e. if my assembly is in c:\data\my.exe and the file that I open is
at c:\my.txt location I want to get ..\my.txt and not c:\my.txt is
there any object that support that functionality ?
Dincer Ozturan

2004-03-28, 11:32 pm

Hi,

You should use:

Application.StartupPath+"\\..\\my.txt";

I hope this helps.


shahar@log-on.com (Shahar) wrote in message news:<e803974e.0403070436.7f2a8c9c@posting.google.com>...
> Hi
> I'm using the OpenFileDialog object to open some file, can I know the
> relative path to my assembly ?
>
> i.e. if my assembly is in c:\data\my.exe and the file that I open is
> at c:\my.txt location I want to get ..\my.txt and not c:\my.txt is
> there any object that support that functionality ?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com