im using this code here
to find a webbroswer newly created
but it wont find any of my broswer
not even my static one called
webbroswer1
on the other end it will find any other control
and dispose of it properly
how can i find a webbroswer by its name and remove it
heres my code
foreach (var c in this.Controls) { if (c is Control) { var x = (Control)c; if (x.Name == dispose) {
MessageBox.Show("this works");
x.Dispose(); break; }
else { bobby, this doesnt work ); break; }
} }
Loading
david seinfeildPosted May 21, 2013, 11:28 AM
VulpesPosted May 21, 2013, 10:27 AM
david seinfeildPosted May 21, 2013, 10:03 AM
VulpesPosted May 21, 2013, 9:34 AM
Are you saying that you want to dispose of all tabpages except the one on which the webbrowser control is located?
david seinfeildPosted May 20, 2013, 4:48 PM
i tried to just go with tabControl1.TabPages.Clear();
but it keeps giving me an error about a missing instance
VulpesPosted May 20, 2013, 3:11 PM
david seinfeildPosted May 20, 2013, 2:41 PM
VulpesPosted May 20, 2013, 12:37 PM
if (c is WebBrowser && c.Name == "webBrowser1") ((WebBrowser)c).Url = newUri(@"http://www.google.com");
david seinfeildPosted May 20, 2013, 12:19 PM
VulpesPosted May 20, 2013, 11:37 AM
david seinfeildPosted May 20, 2013, 11:05 AM
foreach (var c in this.tabControl1.Controls)
the thing is i would love to change the url of the webbroswer in that specific tab
but since its in that tab i cant find it just like i couldnt find that tab at first
anyway to acces that newly created webbrowswer in that tab using that code
,
VulpesPosted May 20, 2013, 8:54 AM
You'd start the ball rolling with:
DisposeControls(this);
david seinfeildPosted May 20, 2013, 6:32 AM
how do i go trough those using the code i displayed
VulpesPosted May 20, 2013, 5:17 AM
If you've added them to a panel, then you will need to iterate through the panel's Controls collection to find them.