Click here to Skip to main content
11,929,249 members (62,495 online)
Click here to Skip to main content
Add your own
alternative version


87 bookmarked


, 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

GeneralMy vote of 1 Pin
SkySoftHelper9-May-11 20:01
memberSkySoftHelper9-May-11 20:01 
GeneralCongratulations on the good work Pin
Rene.DH18-Apr-09 11:43
memberRene.DH18-Apr-09 11:43 
Question[BR /] instead of [P/]? Pin
aj3212-Jun-08 15:18
memberaj3212-Jun-08 15:18 
AnswerRe: [BR /] instead of [P/]? Pin
raiserle21-Dec-11 11:34
memberraiserle21-Dec-11 11:34 
QuestionCan I insert tables? Pin
Drucik_20-Apr-08 14:02
memberDrucik_20-Apr-08 14:02 
AnswerRe: Can I insert tables? Pin
BITS_UK27-May-08 0:13
memberBITS_UK27-May-08 0:13 
Generalcopied imaged from ms word doesn't show Pin
netJP12L23-Jan-08 12:21
membernetJP12L23-Jan-08 12:21 
GeneralImages dont apprear when copied from Ms word Pin
netJP12L23-Jan-08 12:15
membernetJP12L23-Jan-08 12:15 
GeneralThanks, just what I needed Pin
victorbos1-Nov-07 4:21
membervictorbos1-Nov-07 4:21 
QuestionProblem with Deploy Different Version shdocvw.dll Pin
sebandres20-Feb-07 6:31
membersebandres20-Feb-07 6:31 
QuestionHow can i insert a text in a given position? Pin
respiratory10126-Sep-06 12:56
memberrespiratory10126-Sep-06 12:56 
AnswerRe: How can i insert a text in a given position? Pin
Henrik Thulin28-Jun-11 11:06
memberHenrik Thulin28-Jun-11 11:06 
Questionhow to change the language of the text Pin
alihammad28-Aug-06 5:22
memberalihammad28-Aug-06 5:22 
123456uio9-Aug-06 4:16
member123456uio9-Aug-06 4:16 
Questionwhere are html, title, head, meta tags ? Pin
Robcast229-Jun-06 1:38
memberRobcast229-Jun-06 1:38 
AnswerRe: where are html, title, head, meta tags ? Pin
Robcast229-Jun-06 5:00
memberRobcast229-Jun-06 5:00 
QuestionAdding Events Pin
AbhiTheGenius13-May-06 22:50
memberAbhiTheGenius13-May-06 22:50 
AnswerRe: Adding Events Pin
Shlomo Schwarcz13-May-06 23:33
memberShlomo Schwarcz13-May-06 23:33 
GeneralReference Pin
DeathJester_26-Mar-06 10:50
memberDeathJester_26-Mar-06 10:50 
QuestionInvalidCastException Unhandled Pin
pjrinaldi18-Feb-06 19:45
memberpjrinaldi18-Feb-06 19:45 
AnswerI think I know the problem Pin
Shlomo Schwarcz18-Feb-06 21:46
memberShlomo Schwarcz18-Feb-06 21:46 
QuestionRe: I think I know the problem Pin
pjrinaldi19-Feb-06 5:05
memberpjrinaldi19-Feb-06 5:05 
AnswerRe: I think I know the problem Pin
Shlomo Schwarcz19-Feb-06 5:08
memberShlomo Schwarcz19-Feb-06 5:08 
QuestionRe: I think I know the problem Pin
pjrinaldi19-Feb-06 6:03
memberpjrinaldi19-Feb-06 6:03 
AnswerRe: I think I know the problem Pin
pjrinaldi20-Feb-06 18:23
memberpjrinaldi20-Feb-06 18:23 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 6 Jan 2006
Article Copyright 2006 by Shlomo Schwarcz
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid