Solved

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

Posted on 2008-06-12
1
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 127
Easiest intro into .NET CORE? 2 33
.NET universe documentation poster 2 25
Help with modifying xml file using VB.NET 5 10
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 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