Multiple Windows when using AxWebBrowser

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am developing a Windows Foms application that is hosting a WebBrowser
control. I am trying to open multiple windows of my application. I am able
to do that by using the following code in my New Window event:

Form1 newWindow = new Form1();
e.Equals(newWindow.axWebBrowser.Application);
newWindow.Show();
newWindow.Visible = true;

The problem I am facing is: when I close the first window(the one that was
used to create the other windows), all the other ones also get closed. Is
there a way to avoid this?

Thanks.
 
The thing is when your first window gets closed and is cleaned up by the
garbage collector the references to all your other forms also get
disposed. So either make the primary form so that you don't need to
close it, or you can use a custom applcationcontext
http://www.nedcomp.nl/support/origd...mwindowsformsapplicationcontextclasstopic.htm
or if you store the references to the new forms in some static global
table then also it might prevent the other forms from closing.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
 
Back
Top