N
Nathan Allan
When attempting to invoke "Navigate" on an AxWebControl that I
programmatically created, I was getting an
InvalidActiveXStateException exception. After searching around for a
solution to the problem, I couldn't find one that worked reliably. I
found a solution, deduced from the fact that the control seems to work
fine when created by the designer, yet doesn't when created
programmatically. I started with a working scenario in the designer
and eliminated code until I found the solution below. I thought that
I should post this solution, though I have no insight as to why it
works.
FWebBrowser = new AxSHDocVw.AxWebBrowser();
FWebBrowser.BeginInit(); // Seems to be critical the have the
begin...end init
FWebBrowser.Parent = <container>;
FWebBrowser.EndInit();
object LTemp = null;
FWebBrowser.Navigate(FURL, ref LTemp, ref LTemp, ref LTemp, ref
LTemp);
programmatically created, I was getting an
InvalidActiveXStateException exception. After searching around for a
solution to the problem, I couldn't find one that worked reliably. I
found a solution, deduced from the fact that the control seems to work
fine when created by the designer, yet doesn't when created
programmatically. I started with a working scenario in the designer
and eliminated code until I found the solution below. I thought that
I should post this solution, though I have no insight as to why it
works.
FWebBrowser = new AxSHDocVw.AxWebBrowser();
FWebBrowser.BeginInit(); // Seems to be critical the have the
begin...end init
FWebBrowser.Parent = <container>;
FWebBrowser.EndInit();
object LTemp = null;
FWebBrowser.Navigate(FURL, ref LTemp, ref LTemp, ref LTemp, ref
LTemp);