TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roger Garrett
NA
9
21.5k
webBrowser control throws exception
May 20 2011 4:38 PM
I'm writing a C# program that makes use of the webBrowser control. Generally I've been successful in using it but have encountered a problem I can't figure out.
I intercept the DocumentCompleted event from my webBrowser control. During the processing of that event I create an additional webBrowser control and call its Navigate function to tell it to navigate to a specific URL. When I do that it throws an exception : "IWebBrowser2 get from the native ActiveX control did not succeed", and I can see that the axIWebBrowser2 property of the control is null.
My code is approximately like this:
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser newWebBrowser = new webBrowser();
try
{
newWebBrowser.Navigate("http://www.somewebsite.com");
}
catch
{
MessageBox.Show("Excption was thrown!");
}
}
Is it possible that you can't instantiate and call the Navigate method for a webBrowser while processing the DocumentCompleted event for another webBrowser control?
Reply
Answers (
1
)
About MDI forms
Bulk Copy with IDENTITY