I have this application that uses a Webbrowser control to automatically browse. I need to come up with a way to automatically close the browser (dispose), and then create another instance that really works.
Here is the code that I still have.
this.webBrowser2 = new System.Windows.Forms.WebBrowser();
this.webBrowser2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.webBrowser2.Location = new System.Drawing.Point(0, 34);
this.webBrowser2.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser2.Name = "webBrowser2";
this.webBrowser2.ScriptErrorsSuppressed = true;
this.webBrowser2.Size = new System.Drawing.Size(616, 447);
this.webBrowser2.TabIndex = 1;
So, I was thinking if I delete the web browser instance.
webBrowser2.dispose();
And then create a new instance of the webbrowser object.
WebBrowser w = new WebBroswer();
w.Navigate(url);
Unfortunately this will not work. A new browser instance is not displayed, and the deleted browser object remains frozen in the form of a window.
Is there something I'm doing wrong?
thanks