Hi guys i am having a window form, within the form, i have 2 part,
the upper part is a datagridview and the lower part is a web browser (control name :wbBroser).
the situation is this:
when i double click a cell on the datagridview, the web browser will display a web page content, which is working fine.
the code to navigate:
wbBroser.Navigate(strURL)
however, when i click close button which is in the web page, it will prompt out a message :
The web page you are viewing is trying to close the window
do you want to close the window?
yes no
after i click the yes, then the web browser become blank again.
However, when i try to double click a cell in datagridview to launch web browser to view other page, it come out the following error.
COMException was unhandle.
Error HRESULT E_FAIL has been returned from a call to a COM Object.
I am not positive on this one, but use the webbrowser controls WindowClosing event.
when the event fires (I am thinking it should when you click that close button in the webpage) you can set the e.cancel event arg to true to cancel the closing.. then just navigate via code to about:blank to blank out the page. This should keep the handle alive to the webbrowser, and allow you to navigate again without the error.