473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Getting the reference to the control add to a TabControl

I created a tabcontrol toolin my application.(actually i am creating
a
tabbed browser)

when the user clicks on the newtab button(provided by me) the new tab
is added and the webbrowser control is added to that by the following
code.

TabPage t = new TabPage();
t.Text = "tabpage" + i.ToString();
tabControl1.TabPages.Add(t);
WebBrowser w = new WebBrowser();
t.Controls.Add(w);
w.Dock = DockStyle.Fill;

now depeding the current tab selected i want the reference to the
tabpage and the webbrowser control added to that.

index1 = tabControl1.TabIndex;
t1 = tabControl1.TabPages[index1];
now how can get reference to the webcontrol added to t1;

i need the code for this : w1=[the reference to the
webcontrol in t1]

explanation can be in any language....

Jun 14 '07 #1
2 2232
On 14 Jun, 16:10, sravan_reddy001 <sravanganta2...@gmail.comwrote:
I created a tabcontrol toolin my application.(actually i am creating
a
tabbed browser)

when the user clicks on the newtab button(provided by me) the new tab
is added and the webbrowser control is added to that by the following
code.

TabPage t = new TabPage();
t.Text = "tabpage" + i.ToString();
tabControl1.TabPages.Add(t);
WebBrowser w = new WebBrowser();
t.Controls.Add(w);
w.Dock = DockStyle.Fill;

now depeding the current tab selected i want the reference to the
tabpage and the webbrowser control added to that.

index1 = tabControl1.TabIndex;
t1 = tabControl1.TabPages[index1];
now how can get reference to the webcontrol added to t1;

i need the code for this : w1=[the reference to the
webcontrol in t1]

explanation can be in any language....
'get the control off the current tab

Dim controlRef As Control =
TabControl1.SelectedTab.Controls(0) '<- 0 because it's first and only
control on tab

'make it useful by converting from a control into the
WebBrowser control

Dim webControl As WebBrowser = DirectCast(controlRef,
WebBrowser)

'do what you want.
webControl.Navigate(txtAddress.Text)

Jun 14 '07 #2
i got this in VB. but how it will work in C#

is there any equivalent conversion in C#??

Sravan Reddy

Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ColinC | last post by:
Hi, as a newbie to Visual Studio C# Forms development, I'd like some advice on the following. I have a form with a tab control. I have some tab titles that are three words e.g "house &...
7
by: Mark Denardo | last post by:
Hi I have a TabControl object that I need to insert new TabPages into. To append them to the end of the Controls Collection I can do: tc.controls.add(tp) (tc - tabcontrol object) (tp -...
10
by: mikl | last post by:
How do you change the overall background color for a tab control (not on each individual tab). I tried Tabcontrol1.Backcolor = System.Drawing.Color.Blue but this did not work. Thanks mikl
3
by: meh | last post by:
Hi All; After creating a new tab if I delete the tab I cannot close my app from the X in the upper right of the window. NE1 have a clue why. Tried stepping through the delete seems to work fine...
1
by: Flack | last post by:
Hey guys, Here is whats happening. I have a StringBuilder, a TextBox, and a TabControl with one TabPage. On my main form, I created and displayed a fairly big maze. While the app is solving...
3
by: Marc Solé | last post by:
Hello to everybody. I have a little problem with a Custom Control that I have created. The thing is that in my control, when I click a button, it should create another object in the main form. ...
17
by: Kbalz | last post by:
I'm developing a Wizard type program, and I'm flipping between steps by using a TabControl.. buttons on each tabPage move to the next or previous tabPage. When I press CTRL+Tab however, the...
1
by: sravan_reddy001 | last post by:
I created a tabcontrol toolin my application.(actually i am creating a tabbed browser) when the user clicks on the newtab button(provided by me) the new tab is added and the webbrowser control...
2
by: naamala | last post by:
Hi, I need to change individual tab's background color in TabControl in windows form. I am able to change the Backgrond color of each tab in TabControl with changing the property...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.