Solved

Create a hyperlink in a C# 2005 project to a html page contained in the project

Posted on 2008-06-12
1
474 Views
Last Modified: 2013-11-26
Hi there

I've written a Window application in Visual C# 2005 which displays a form. This form contains a WebBrowser control. I have also in the solution a html page called HTMLPage3.htm

I'd like to fill the web browser with an image having a hyperlink to HTMLPage3.htm

How can I do that ?

The line below doesn't work.

Thanks in advance
webBrowser1.DocumentText = "<a href=\"HTMLPage3.htm\"><img  src=\"http://.../image.gif\" /></a>";

Open in new window

0
Comment
Question by:B_B_Boris
1 Comment
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 21771609
>>I have also in the solution a html page called HTMLPage3.htm
Where is this file? you have to provide a full path to the file, if not, the browser will not know where to locate the file. Since, once installed, the file will be located in different folders, you will have to provide the correct path, something like:


webBrowser1.DocumentText = string.Format("<a href=\"file:\\\\{0}\\HTMLPage3.htm\"><img  src=\"http://.../image.gif\" /></a>", theFolder);

where theFolder variable is some folder where the file is located once installed, it can be obtained like:
string theFolder = Application.StartupPath;
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Advice on Xojo as a development tool over VB. 4 55
HTTPS jquery doesn't work 9 62
Not seen Link button 5 39
Formula for calculating ROI on training 6 27
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question