I have this App that uses the Webbrowser control to do automated browsing. I need to come up with a way to automatically close the browser (dispose), then create another instance that actually works.
Here's some of the code that I have so far.
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 dispose of the webbrower instance.
webBrowser2.dispose();
And then creating a new instance of the webbrowser object.
WebBrowser w = new WebBroswer();
w.Navigate(url);
Unfortunately this doesn't work. The new instance of the browser doesn't show up and the disposed browser object just stays frozen in the windows form.
Is there something I am doing wrong?
Thanks