473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Link labels to relative paths on the local machine

18
Hi, I would like to create a link in my program that will open a file stored in a directory relative to the program itself.
e.g. if the program is in the program folder, the file I want to open is program/data/file.html.

I have no trouble creating links to websites or files specified with an absolute path but have been unable to open a file using a relative path. Any help would be appreciated.
AJ
Mar 19 '09 #1
2 2730
tlhintoq
3,525 Expert 2GB
Take a look at these. You should be able to put them together to get what you need.

Expand|Select|Wrap|Line Numbers
  1. Application.ExecutablePath;
  2. System.IO.Directory.GetParent;
Mar 19 '09 #2
Asja
18
Thank you very much, the following worked:

HelpFileLink.Links[0].LinkData = "file:///" + System.IO.Directory.GetParent( Application.ExecutablePath ).FullName + "/data/Help.html"

If it wasn't for the need to specify the "file:" protocol just using "./data/Help.txt" works.
Mar 20 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Doug | last post by:
If I were to write an include with a relative path like include("../conf/config.php"); What is the use? As far as I understand it, the path is relative to the first script that is called by...
5
by: jason | last post by:
Can anyone help me find a solution to quickly working out relative paths to a folder in the root of my server... Although it easy when you go - say - two levels down: .../includes it...
2
by: Alex | last post by:
Hi. I need some help on this. I have a user control (a header) in my root directory, and all my pages use that control. Then a created a folder (in my root directory) and put a new page inside it,...
3
by: tsteinke | last post by:
Okay so I had some aspx pages with document relative links to images and webusercontrols (which also have doc relative pats to images) I wanted to use forms authentication on, so I was forced to...
9
by: Garann Means | last post by:
I have a subfolder under wwwroot set up as a virtual directory with its own application name in IIS. I pulled it down from Visual Source Safe and, on the machine where it's normally hosted, it...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
8
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the...
15
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.