Display HTML data on windows form C#.net

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
This is in conjunction to a previous question regarding text compare within c#. Turns out the return of the text compare is an html formatted text with colored differences.

Now the question is, how do you display html data within a windows form in C#. I have tried using RichTextbox and a regular textbox to accomplish this, but nothing concrete yet. Also have read about using the Webbrowser object, but that only seems to setup a link to display a html file in a browser and not within the form.

Any suggestion in regards to this would be appreciated.
Question by:jimbob_sf
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
  • 2
  • 2
LVL 13

Expert Comment

ID: 26290656
Use the webbrowser object
LVL 13

Expert Comment

ID: 26290657
Use the webbrowser object
LVL 13

Expert Comment

ID: 26290658
You should use the WebBrowser control (.Net control from the toolbox for example). Then, you can use the URL property to give it the address of your HTML doc.
LVL 13

Accepted Solution

kaylanreilor earned 2000 total points
ID: 26290703
So to use the System.Windows.Forms.WebBrowser control, a quick example is: I have an HTML file on my harddrive, it could have been a resource, and I simply set the property this way:
webBrowser1.Url = new Uri(@"S:\tmp\confirm.html");
On the other hand I could have used the Navigate() method as well. Note that one of the constructors of the System.Uri class can take a StreamingContext as parameter so that you can for example pass an handle on a mapped file instead of a file on disk : http://msdn.microsoft.com/en-us/library/system.runtime.serialization.streamingcontext.aspx.
You have some other discussion or examples here http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx or here http://www.dotnetheaven.com/UploadFile/mahesh/WebBrowserControl05072005051350AM/WebBrowserControl.aspx.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

765 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