471,336 Members | 1,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Using Web Browser control (AxShDocVw) to display app-generated HTML

I've reached the conversion of a part of my application from VB6 to VB.NET
which uses the COM Web Browser control to display HTML content generated by
my application.

The general approach used in VB6 is as follows:

Open the form containing the browser
Wait a few seconds for the Browser.Document property to initialise
With the Document object, call the following methods:
.Clear()
.Open()
.Write(html)
.Close

This all works perfectly in VB6. In VB.NET however, I've been completely
unable to get this to work. The Document property of the Browser control is
always Nothing and no matter how long I wait it doesn't ever get set to an
object.

I also tried calling the Navigate() method of the browser object, and also
dropping URLs from other web browser windows into the browser control. In
each case a System.Runtime.InteropServices.MarshalDirectiveExc eption
occurred with the message, "Marshaler restriction: Excessively long string."

Is there something special I need to do in order to use the Web Browser
control in my project?

Can anyone point me to some sample code that displays application-generated
HTML within the browser?

I could really use some help here as this is a critical part of my
application, without it my project will fail. :(

Thanks in advance,

--

(O)enone
Nov 21 '05 #1
1 4671
Oenone wrote:
This all works perfectly in VB6. In VB.NET however, I've been
completely unable to get this to work.


On further investigation, it appears to only be a problem if the form
containing the control is an MDI child form. If I don't set the MdiParent
property then the browser works acceptably (though it raises about a large
number of exceptions as the form opens).

I've tried setting the MdiParent both in the constructor of the Form, the
Load event, even after I set the HTML into the document, but each time the
browser just appears empty.

I can limp by with this operating as it currently is (looking longingly
towards the release of VS2005 with its built-in managed browser control) but
would love to know why this control is acting in the way it is! :)

Thanks,

--

(O)enone
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dougie | last post: by
7 posts views Thread by Mohammed Abdel-Razzak | last post: by
1 post views Thread by Daniel Frede | last post: by
10 posts views Thread by Yuk Tang | last post: by
reply views Thread by Bruce | last post: by
4 posts views Thread by =?Utf-8?B?RGF2ZSBF?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.