Click here to Skip to main content
Email Password   helpLost your password?

Introduction

This article presents you a small wrapper class around the Windows Forms 2.0 WebBrowser control.

Features

The wrapper is no rocket science but provides some features I struggled with in the past. We use the control in several of our own (internal) applications.

Some of the features include:

Using the Code

To include the code in your own project, simply include the "ZetaHtmlEditControl.dll" assembly into your project.

Add the assembly to your Visual Studio .NET 2008 Windows Forms Designer Toolbox if you want to be able to drag the ExtendedWebBrowser control to your forms. Alternatively create and initialize an instance of the ExtendedWebBrowser control by code.

Setting HTML

To put HTML from your code into the control, assign the HTML code to the ExtendedWebBrowser.DocumentText property. You do not have to pass a complete HTML document with HEAD and BODY tags but only the actual content that you would write inside the BODY tag.

Getting the HTML

To read out the HTML from the control, call the ExtendedWebBrowser.GetDocumentText(string folderPath) method. The method takes one parameter "folderPath" that tells the control where to store newly passed images from the clipboard.

Summary

This article quickly introduced a wrapper around the Windows Forms 2.0 WebBrowser control that adds some extra functions to make it more usable in a real-world-application. Feel free to copy, modify or extend the control to match your own requirements.

To ask questions, suggest features or provide other comments, please use the comments section at the bottom of this article.

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralFirst of all 5 from me
mheidari
2:21 24 Nov '09  
hi dear

first of all you got five for me, now i have a question about your editor,

i already use some of html editors in win forms but some times i got some unhandled exception that throwed from COM. for example when im using editors that wraps WebBrowser in my own win forms, when im closing my form then throws an exception :

<b>RaceOnRCWCleanup was detected</b>
Message: An attempt has been made to free an RCW that is in use.   The RCW is in use on the active thread or another thread.   Attempting to free an in-use RCW can cause corruption or data loss.

unfortunately i have no idea for this Confused and why this exception raises   D'Oh!

now if i use your editor ! what happens to me   Red faced


also im sorry for my highland English speaking   Big Grin

If you think you has fallen out of an elephant's nose ; I make you a donkey

GeneralRe: First of all 5 from me
Uwe Keim
3:47 24 Nov '09  
That sounds strange.

I would suggest in first place that this is an issue with your machine, rather than with the WebBrowser control in general.

Does the error also occur when you use the controls on another PC?

Thanks for voting Smile
Uwe

My personal 24/7 webcam
Zeta Test - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now!
Zeta Producer Desktop CMS - Intuitive, very easy to use. Download now!

GeneralRe: First of all 5 from me
mheidari
23:14 24 Nov '09  
i do not testing the same program in another machine because i think this error happens in every where but in anyway i use your code in my app and so testing in some machines and i hope this works excellent.

thank you Uwe   Smile

If you think you has fallen out of an elephant's nose ; I make you a donkey

General5 Sterne / 5 Stars
Midnight Run
6:43 19 Nov '09  
Hi Uwe,
ich wollte nur mal ein Danke hier lassen, weil deine Programme echt super sind und man echt viel lernen kann Big Grin
Ich habe mir auch mal den ZetaTest angesehen. Unterstützt das Programm den IEEE Standart ? Ich konnte keine Infos auf der Seite finden.

Mfg
GeneralRe: 5 Sterne / 5 Stars
Uwe Keim
6:49 19 Nov '09  
Thanks/Danke Smile

Let me answer in English to get a broader audience:

Zeta Test [^] supports no official standard.

We wanted to make a tool that is capable of being useful in real world scenarios while avoiding to be over complicated (like e.g. HP QuickTest [^] Wink).

We have several larger customers that prefer Zeta Test over other, more complete solutions since we are able to ship with less features (but those really required) for a much lower price.

(Enough of the advertising for now; but you asked for)

My personal 24/7 webcam
Zeta Test - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now!
Zeta Producer Desktop CMS - Intuitive, very easy to use. Download now!

GeneralRe: 5 Sterne / 5 Stars
Midnight Run
6:55 19 Nov '09  
Thanks for your quick answer. And sorry to all for speaking in German. Smile
General"Control" Project does not compile - Missing File?
andre12345
3:12 18 Nov '09  
Unable to copy file "App.config" to "..\..\Bin\Debug\ZetaHtmlEditControl.dll.config". Could not find file 'App.config'.
GeneralRe: "Control" Project does not compile - Missing File?
Uwe Keim
4:11 18 Nov '09  
Thank you. I've just uploaded a new source version that compiles.

My personal 24/7 webcam
Zeta Test - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now!
Zeta Producer Desktop CMS - Intuitive, very easy to use. Download now!

GeneralRe: "Control" Project does not compile - Missing File?
andre12345
1:53 19 Nov '09  
Yes, it done now compile, thank you!


Last Updated 18 Nov 2009 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010