470,566 Members | 1,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,566 developers. It's quick & easy.

AxWebBrowser without form

Hi

Is there anyway to get a WebBrowser to work without placing it on a form.

I want to be able to instantiate a browser, complete some of the fields and
submit, but whenever I try to navigate I get:

An unhandled exception of type 'InvalidActiveXStateException' occurred in
axinterop.shdocvw.dll

I'm assuming that's because it hasn't got a handle assigned to it, is there
any other method/workaround?

Ideas?

Thanks
Kev
Nov 16 '05 #1
1 2232
Hi,
I'm not sure is this the same problem as the one i had, so maybe this is not
solution for your problem but it wont hurt if you try :)

A handle for AxWebControl is created, not when you create the control but
when it is shown.
The bug here is that when you try to close form which contains AxWebBrowser
control (actually when the GC try to dispose the control) and the control is
not yet shown so it doesn't have handle, it raises exeption similar to the
one you had mentioned.

The solution was to hide the control until you need to show it. So, after:

AxWebBrowser aWB = new AxWebBrowser(); // actually after
InitializeComponent();

somewhere in constructor add:

aWB.Hide();

and:

aWB.Show();

when you need to display it!

"Mantorok" <no**@tiscali.co.uk> wrote in message
news:cr**********@newsfeed.th.ifl.net...
Hi

Is there anyway to get a WebBrowser to work without placing it on a form.

I want to be able to instantiate a browser, complete some of the fields and submit, but whenever I try to navigate I get:

An unhandled exception of type 'InvalidActiveXStateException' occurred in
axinterop.shdocvw.dll

I'm assuming that's because it hasn't got a handle assigned to it, is there any other method/workaround?

Ideas?

Thanks
Kev

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Martin Ho | last post: by
reply views Thread by Matthias Kwiedor | last post: by
1 post views Thread by Arturo j Torres | last post: by
1 post views Thread by Christoph L | last post: by
3 posts views Thread by Michael C | last post: by
1 post views Thread by Les Caudle | last post: by
3 posts views Thread by Clint MacDonald | last post: by
12 posts views Thread by Don Juan | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.