System.ComponentModel.Win32Exception: Class already exists

Posted on 2007-10-19
Last Modified: 2013-12-17
Hi, I have written a small c# class (.dll) that takes html string removes all the HTML tags sends it back to me in rtf format.  I have getting following error on .aspx page that calls this dll.
Class already exists
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: Class already exists

Source Error:

Line 23:             thisString = Request.Form["rctext"].ToString();
Line 24:             retVal = new TextToRtf(thisString);
Line 25:             retVal.textToRTF();
Line 26:             outString = retVal.getRTF();
Line 27:             Response.Write("Member ID: " + Request.Form["thisindid"].ToString());

Source File: D:\InetPub\wwwroot\aednet\www\leadership\textrtf.aspx    Line: 25

Stack Trace:

[Win32Exception (0x80004005): Class already exists]
   System.Windows.Forms.WindowClass.RegisterClass() +1091
   System.Windows.Forms.WindowClass.Create(String className, Int32 classStyle) +181
   System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) +215
   System.Windows.Forms.Control.CreateHandle() +213
   System.Windows.Forms.Control.get_Handle() +60
   System.Windows.Forms.Control.CreateHandle() +200
   System.Windows.Forms.TextBoxBase.CreateHandle() +54
   System.Windows.Forms.Control.get_Handle() +60
   System.Windows.Forms.RichTextBox.ForceHandleCreate() +5
   System.Windows.Forms.RichTextBox.set_SelectedText(String value) +13
   System.Windows.Forms.TextBoxBase.AppendText(String text) +105
   TextToRtf.TextToRtf.textToRTF() in c:\documents and settings\csh\my documents\visual studio projects\texttortf\class1.cs:30
   ASP.textrtf_aspx.Page_Load() in D:\InetPub\wwwroot\aednet\www\leadership\textrtf.aspx:25
   System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +10
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750
Please Help.
Question by:bella28
    LVL 21

    Accepted Solution

    It appears that the code that you are trying to update the richtextbox with the value from the page. Try changing this richtextbox to a normal text box, see what happens?

    Author Comment

    I am trying to convert all text into rtf format.....

    Please help

    Author Comment

    I have resolved this issue.

    All I had to do was use custom RichTextBox (RichTextBoxEx) I purchased and update my framework form 1.1 to 2 (or 3).

    Thank You

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now