473,408 Members | 1,852 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,408 software developers and data experts.

TabControl question

Hello
I have a TabControl1 in my Window Form. In this TabControl, I have three
tabs: TabPage1, TabPage2, TabPage3. I also have a button. What I want is
when I am in TabPage2 or TabPage2, I can click this button and I can see
TabPage1 ( I does not want to click on the tab). My code below (for the
button ) does not work
TabControl1.TabPages.Item(0).BringToFront()

Could you please tell me how to do that.

Many thanks

S.Hoa
Nov 21 '05 #1
5 3623
shoa wrote:
Hello
I have a TabControl1 in my Window Form. In this TabControl, I have three
tabs: TabPage1, TabPage2, TabPage3. I also have a button. What I want is
when I am in TabPage2 or TabPage2, I can click this button and I can see
TabPage1 ( I does not want to click on the tab). My code below (for the
button ) does not work
TabControl1.TabPages.Item(0).BringToFront()

Could you please tell me how to do that.

Many thanks

S.Hoa


Hi,

I believe the TabControl has a property for this,
maybe it's called ActiveTab or SelectedTab.

Hope this helps.

stax
Nov 21 '05 #2
shoa wrote:
My code below (for the button ) does not work
TabControl1.TabPages.Item(0).BringToFront()


Try:

\\\
TabControl1.SelectedIndex = 0
///

You could also use the SelectedTab property if you want; this performs the
same function but takes a reference to a TabPage object instead of a tab
index.

Hope that helps,

--

(O)enone
Nov 21 '05 #3
"shoa" <so*@slingshot.co.nz> schrieb:
I have a TabControl1 in my Window Form. In this TabControl, I have three
tabs: TabPage1, TabPage2, TabPage3. I also have a button. What I want is
when I am in TabPage2 or TabPage2, I can click this button and I can see
TabPage1 ( I does not want to click on the tab). My code below (for the
button ) does not work
TabControl1.TabPages.Item(0).BringToFront()


\\\
Me.TabControl1.SelectedTab = Me.TabControl1.TabPages(1)
///

- or -

\\\
Me.TabControl1.SelectedIndex = 1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4
Personally, I always prefer referencing the tab by name.. I got caught out
when I reordered the order of tabs after my original development.. Whilst I
guess it's less efficient - you always get the tab you thought you wanted!

Regards
Simon
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e$**************@TK2MSFTNGP14.phx.gbl...
"shoa" <so*@slingshot.co.nz> schrieb:
I have a TabControl1 in my Window Form. In this TabControl, I have three
tabs: TabPage1, TabPage2, TabPage3. I also have a button. What I want is
when I am in TabPage2 or TabPage2, I can click this button and I can see
TabPage1 ( I does not want to click on the tab). My code below (for the
button ) does not work
TabControl1.TabPages.Item(0).BringToFront()


\\\
Me.TabControl1.SelectedTab = Me.TabControl1.TabPages(1)
///

- or -

\\\
Me.TabControl1.SelectedIndex = 1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
"Simon Verona" <ne**@aphroditeuk.com> schrieb:
Personally, I always prefer referencing the tab by name.. I got caught out
when I reordered the order of tabs after my original development.. Whilst
I guess it's less efficient - you always get the tab you thought you
wanted!


ACK, it may be better to use the fields generated for the tabpages instead
of the 'TabPages' collection:

\\\
Me.TabControl1.SelectedTab = Me.TabPage1
///

When giving the tab pages meaningful names this will lead to more readable
code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

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

Similar topics

5
by: meh | last post by:
New to C#... I have a tab page with a handful of controls on it (label, combobox, etc.). Is it possible to "boilerplate a tabPage with the controls "like a MDI childForm" so that adding a new...
0
by: David Veeneman | last post by:
I've come across an odd bit of behavior on the VS 2005 TabControl, and I'm wondering if its a bug, or if I'm missing something. I have a TabControl with five tab pages. Each page has a...
5
by: Max | last post by:
This is a two part question. First, how does one go about designing forms that can reflect the XP theme? Take the TabControl for example, even on default the one that you can use in VB.NET looks...
2
by: Richard | last post by:
Hi, Simple tabcontrol question: I have a tab control with a number of tabpages on it. What I want is to show a particular tabpage when I click a button that is not on the tabcontrol. Can...
8
by: ChrisK | last post by:
Hi, I'm beginner with VB.net and i have a trouble... At work, they decided to program with tabcontrol...and i'mm in charge of this ! There is my problem. I've a form with one tabcontrol (TBC1...
5
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in...
2
by: Rex the Strange | last post by:
I suspect the answer to this question is "you can't," but here goes anyway: I have a tabcontrol which contains, of course, various tabpages (added programmatically at runtime, but this is...
0
by: qinger | last post by:
Hello, I am trying to organize the controls on a TabControl. The tabcontrol is sitting on a dialog with OK and Cancel buttons. So I created 2 TableLaoutPanels -- one for TabControl and one for...
0
by: =?Utf-8?B?TWFydGluIw==?= | last post by:
Hello everybody! Please note that I have posted same question in different forums with no success. So If you tried to help me there, please do not consider the repost as rude! I'm working on...
2
by: Gav | last post by:
I am writing an application where I will have a TabControl and 3 styles of Tabs to go in it, each containing different controls. The tabs will be added to the tabcontrol when items are clicked on...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.