Link to home
Start Free TrialLog in
Avatar of Dalexan
DalexanFlag for Afghanistan

asked on

mshtml type mismatch for document.write

I have the following code (vb.net 2010 express):

        Dim doc As mshtml.HTMLDocument
        axWebBrowser1.Navigate("about:blank")
        doc = CType(axWebBrowser1.Document, mshtml.HTMLDocument)
        doc.close()
        doc.open("about:blank")
        Dim sHTML(0) As String
        sHTML(0) = script(e.Node.Index).branch_text
        doc.write(sHTML)
        sHTML = Nothing
and I'm getting a type mismatch on the doc.write command.  I also tried Dim sHTML() as Object = ...branch_text but the same results.  The WebBrowser1 object is from the axSHDocVw.dll.

I can't seem to get the right combination of things to get this to work  Please Help.
Avatar of kaufmed
kaufmed
Flag of United States of America image

You're trying to write an array using a function that expects a string. Why did you create an array? Can you not use:

...

Dim sHTML As String
sHTML = script(e.Node.Index).branch_text
doc.write(sHTML)
...

Open in new window

Avatar of Dalexan

ASKER

Tried that first...got the mismatch error.  doc.write is expecting a "ParamArray psarray() as Object", so I tried the array but still no luck.
Are you not using the Webbrowser control? You can do

webbrowser1.document.write("<html><body>New Document</body></html>")

http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.write.aspx
Avatar of Dalexan

ASKER

Does it allow editing?  The display is in an application to allow managers to edit scripts being displayed.  The users are running an app that has a WebBrowser control to view the scripts, and a separate window containing the axWebBrowser control is used to allow editing...everything I found online indicated the WebBrowser control couldn't do this.
Avatar of Dalexan

ASKER

Additional info...the editor is supposed to be a WYSIWYG editor...
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dalexan

ASKER

This is FANTASTIC!  Thank you for pointing us in the right direction.  Hopefully others searching for a HTML WYSIWYG Editor will be able to find this now.
This includes a stand-alone app and an API to implement...we're using the API and it works great!