473,396 Members | 2,003 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,396 software developers and data experts.

tabcontrol hair pull

I am pulling my hair out as this should be simple and is not.

In the main form I have a Tabcontrol I have 3 tabs and when I start the program I want to have the middle tab up. This never seems to happen.

this.tabControl1.TabPages[1].Select();

I have also tried

this.tabControl1.TabPages[1].Show();

this.tabControl1.TabPages[1].Focus();

I would try
this.tabControl1.TabPages[1].Blowup(yeahh1!!!); If it would work but at this point .... It just gives me an error .

Help me before I am bald please.
Mar 29 '09 #1
3 1840
tlhintoq
3,525 Expert 2GB
Have you tried...

tabControl.SelectTab(int index);

SelectTab Overloaded. Makes the specified tab the current tab.
TIP: Read through the MSDN Library about each new control you are learning. Read through each of its methods. You don't have to experiment with each one, but if you read through the definition of all the methods you have them stuck in the back of your head a little better.

TabControl members
Mar 29 '09 #2
That did not work as the

tabControl.SelectTab(int index);

SelectTab option did not seem to exist

However it got me on the right track.


tabControl1.SelectedTab = tabPage2; This did work

tabControl1.SelectedTab = nameOfTheTab;
Mar 29 '09 #3
tlhintoq
3,525 Expert 2GB
@chris52672
Right...
SelectTab is a member of the TabControl control.
tabControl1 is your instance of a TabControl.
Just like your Form1 is an instance of a Form control.

You will almost always being using members with instance references.

If you had 4 tab controls on your page for example that would be the only way to instruct a specific control and not all of them...

Expand|Select|Wrap|Line Numbers
  1. TabControl1.SelectTab(4);
  2. TabControl3.SelectTab(7);
and so on...

This is why it is very important to give your controls meaningful names when possible. If you created 17 buttons on a page do you really want code that looks like

Button17.backgroundcolor = color.blue;
Button4.enabled = false;

and so on?

Expand|Select|Wrap|Line Numbers
  1. btnSave.backgroundcolor = color.blue;
  2. btnExit.enabled = false;
is so much easier to understand.
Mar 29 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould...
2
by: Patrick McGuire | last post by:
I want to place a tabControl with almost identical properties on several forms. I think the best way is to define a UserControl that inherits System.Windows.Forms.TabControl, and place all my...
3
by: Steve Cutting | last post by:
Hi all, I have a CheckedListBox on one pane of a TabControl on a form. I find that whenever the user clicks a different tab then comes back, any checks that were in the list have disappeared. ...
9
by: Michael Turner | last post by:
Hi Guys Having problem with the tab control, I need to set the background color to something different than the standard, I have found code on the web and now can redraw the tabpage buttons so...
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: crazyartmichael | last post by:
ok, so im trying to set a drag and drop feature, where i can pull the objects up and towards me in 3d, then drop them back down away from me. I also want these two objects to be constantly connected...
1
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all In a Visual Studio 2005 C# project, I have a simplest tabcontrol with two tabpages. When I set tab control's Alignment property to Right, tab texts (captions) disappear. Does anybody...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.