none
Need - VB - Windows Forms App: wysiwyg html editor control RRS feed

  • Question

  • I Need a - Windows Forms App: wysiwyg html editor control. I am building an email client and need to be able to reply or fwd html encoded email bodies.

    Basically I need to be able to edit rendered html. I have tried useing a webbrowser control in edit mode. The problem with that is I am unable to set or get the documentHTML. I have html in string variables and need to be able access the documentHTML in my VB code.

    I have looked for custom controls to do this. Currently I am converting the html to rtf format, editing and then converting back to html encoding.

    Thank you for your help. 

    Thursday, September 17, 2015 12:00 AM

Answers

  • Thank you _Omar

    This Helped: www.codeproject.com/Articles/19642/WYSIWYG-HTML-Editor-in-NET-C-version

    Here is my VB test code for anyone who might have this same problem in the future....

    Public Class Form1
        Private doc As mshtml.IHTMLDocument2

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            WebBrowser1.DocumentText = " "
        End Sub

        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

            doc = WebBrowser1.Document.DomDocument
            doc.designMode = "On"
            doc.write("Hello World!")

        End Sub

    End Class

    • Marked as answer by NX500 Thursday, September 17, 2015 9:20 PM
    Thursday, September 17, 2015 9:20 PM

All replies

  • Hi NX500,

    Since this issue is more related to Windows Forms. I will help you move it to the Windows Forms Control forum. It is appropriate and more experts will assist you.

    Regards,
    Weiwei

    Thursday, September 17, 2015 8:43 AM
  • I need a (Windows Forms App) wysiwyg html editor control. Basically I need to be able to edit rendered html. I have tried several approaches.

    1) I have tried useing a webbrowser control in edit mode. The problem with that is I am unable to set or get the documentHTML. I have html in string variables and need to be able access the documentHTML in my VB code.

    VB code: WebBrowser.Document.ExecCommand("EditMode", False, Nothing)

    I think there should be a way to use ExecCommand to get a reference to the inner HTMLdocument's interface. But I do not know how to code this.

    2) I have looked for custom wysiwyg html editor controls.

    3) Currently I am converting the html to rtf format, editing and then converting back to html encoding. This is really not a good solution.

    Thank you for your help. 

    Thursday, September 17, 2015 8:43 AM
  • Thank you _Omar

    This Helped: www.codeproject.com/Articles/19642/WYSIWYG-HTML-Editor-in-NET-C-version

    Here is my VB test code for anyone who might have this same problem in the future....

    Public Class Form1
        Private doc As mshtml.IHTMLDocument2

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            WebBrowser1.DocumentText = " "
        End Sub

        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

            doc = WebBrowser1.Document.DomDocument
            doc.designMode = "On"
            doc.write("Hello World!")

        End Sub

    End Class

    • Marked as answer by NX500 Thursday, September 17, 2015 9:20 PM
    Thursday, September 17, 2015 9:20 PM