Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1455
  • Last Modified:

Display HTML data on windows form C#.net

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.
0
jimbob_sf
Asked:
jimbob_sf
  • 2
  • 2
1 Solution
 
zadeveloperCommented:
Use the webbrowser object
0
 
zadeveloperCommented:
Use the webbrowser object
0
 
kaylanreilorCommented:
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.
0
 
kaylanreilorCommented:
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now