Click here to Skip to main content
13,800,574 members
Click here to Skip to main content
Add your own
alternative version


89 bookmarked
Posted 6 Jan 2006


, 6 Jan 2006
Rate this:
Please Sign up or sign in to vote.
Building a simple WYSIWYG (What You See Is What You Get) HTML Editor in C#.

Sample Image


I have found different code samples showing how to create a visual HTML editor in ASP using a text area. However, I needed a good editor for my WinForms application, but I couldn’t find a good example. Eventually, I wrote one from scratch after I converted some MFC code I found on the net. Based on the IE Browser control, you can create a powerful editor that allows you to manipulate HTML tags visually and add any tags you want.

Using the code

The code is a simple form, and very easy to understand. In order to make it work, you first need to include two COM libraries:

  1. The Microsoft Web Control found in: c:\windows\system32\shdocvw.dll (add as a COM control).
  2. MSHTML: c:\windows\system32\MSHTML.tlb (add as a COM reference).

The reason for the tlb is that the mshtml.dll is used by the Windows system, and therefore is not accessible.

You don't need to worry about deployment: all Windows users will have these DLLs in their system directory.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Shlomo Schwarcz
Web Developer
Israel Israel
Shlomo had worked for several years as a software engineer and project manager, developing software for the enterprise market, in Microsoft.NET and Java J2EE environment. Before establishing Shefer’s SAP department, Shlomo worked at SAP Labs and took part of the NetWeaver and Enterprise Portal development team.

Shlomo has many years of experience with SAP customers and has also teaches official SAP courses around the world.

You may also be interested in...

Comments and Discussions

GeneralRe: I think I know the problem Pin
brb55485-Feb-09 11:43
memberbrb55485-Feb-09 11:43 
GeneralBuild error Pin
pietro7711-Jan-06 5:35
memberpietro7711-Jan-06 5:35 
GeneralRe: Build error Pin
Shlomo Schwarcz11-Jan-06 20:23
memberShlomo Schwarcz11-Jan-06 20:23 
GeneralRe: Build error Pin
pietro7711-Jan-06 23:24
memberpietro7711-Jan-06 23:24 
GeneralRe: Build error Pin
Mulga24-Sep-09 20:14
memberMulga24-Sep-09 20:14 Pin
mattraffel10-Jan-06 8:38
membermattraffel10-Jan-06 8:38 
GeneralRe: Pin
cadred10-Jan-06 12:51
membercadred10-Jan-06 12:51 
Generaldoc.execCommand Pin
sides_dale6-Jan-06 19:10
membersides_dale6-Jan-06 19:10 
GeneralRe: doc.execCommand Pin
fwsouthern7-Jan-06 19:31
memberfwsouthern7-Jan-06 19:31 
GeneralRe: doc.execCommand Pin
Shlomo Schwarcz7-Jan-06 20:37
memberShlomo Schwarcz7-Jan-06 20:37 
GeneralFYI: HTMLEditor by Tim Anderson Pin
Marc Sommer6-Jan-06 9:35
memberMarc Sommer6-Jan-06 9:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.181215.1 | Last Updated 6 Jan 2006
Article Copyright 2006 by Shlomo Schwarcz
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid