• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1144
  • Last Modified:

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.
0
Dalexan
Asked:
Dalexan
  • 4
  • 2
1 Solution
 
käµfm³d 👽Commented:
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

0
 
DalexanAuthor Commented:
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.
0
 
CodeCruiserCommented:
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
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
DalexanAuthor Commented:
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.
0
 
DalexanAuthor Commented:
Additional info...the editor is supposed to be a WYSIWYG editor...
0
 
CodeCruiserCommented:
0
 
DalexanAuthor Commented:
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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now