navigating a webbrowser on a form thats on a tabpage

ethicalhacker

Well-known member
Joined
Apr 22, 2007
Messages
142
Location
Delhi,India
Programming Experience
5-10
I have a tab control and the tabpage has a form form1 and form1 contains a webbrowser control
how do I call the webbrowser control thats on the form?
say I want to navigate the webbrowser1.navigate(toolstripcombobox.text)
 
VB.NET:
webbrowser1.navigate(toolstripcombobox.text)
 
A Form? Ever heard of UserControls? ;)

It's same though, use the reference you have to the "form" instance or search the Controls collection of the Tabpage for it. Controls on forms/usercontrols are declared Friend by default so you can access them directly through the type. ex:
VB.NET:
dim f as new form1
f.webbrowser1.navigate(url)
if the name of the control on tabpage is "thecontrol" and the type is "SomeUserControl" you can for example use the string indexer of the Controls collection and cast the returned object (that is of type Control) to get access to the type specific members:
VB.NET:
directcast(tabpage1.controls("thecontrol"), someusercontrol).webbrowser1.navigate(url)
 
not yet solved :(

I have used the following control at
http://www.codeproject.com/vb/net/MDITabControl.asp
It makes tabs with the form on it ok but i cant refrence the webbrowser control on the form to be navigated
I tried direct cast and other things and it dint work
any help?
 
Back
Top