473,770 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Tabs on a Tab Control

ADezii
8,834 Recognized Expert Expert
One frequently asked question at TheScripts is how to set focus/make active a specific Tab on a Tab Control other than clicking on it. Before I provide the answer, I feel as though a little summary information would be most helpful.

__1. An individual Tab on a Tab Control is actually a Page Object. For this discussion, we will use the terms Tab/Page interchangeably , however.
__2. Each Page Object is a member of the Pages Collection which includes all Pages on a Tab Control.
__3. Each Page Object provides a Controls Collection which references all Controls on a specific Tab/Page.
__4. Now that you are thoroughly confused, there are basically 5 Methods for referring to an individual Tab on a Tab Control. We will be using the SetFocus Method to demonstrate this point.

ASSUMPTIONS:
__1. Tab Control name: TabCtl1
__2. Number of Tabs/Pages: 6
__3. Tab/Page Captions: Page1, Page2, Page3, Page4, Page5, Page6
__4. Tab/Page Names: pgeOne, pgeTwo, pgeThree, pgeFour, pgeFive, pgeSix

Expand|Select|Wrap|Line Numbers
  1. Method 1:
  2. Me!TabCtl1.Pages(0).SetFocus - set Focus to the 1st Tab
  3.  
  4. Method 2:
  5. Me!TabCtl1.Pages!pgeThree.Setfocus - set Focus to 3rd Tab
  6.  
  7. Method 3:
  8. Me!TabCtl1.Pages("pgeFour").Setfocus - set Focus to 4th Tab
  9.  
  10. Method 4:
  11. Me!TabCtl1.Value = 4 - makes the 5th Tab active
  12.  
  13. Method 5:
  14. SendKeys "%a" - makes the 6th Tab active (a is a 'Hot Key' in the Caption of this Tab. 
NOTE: Should Tabs be added or deleted, your code may have to be modified in order to set Focus to the proper Tab
Mar 11 '07 #1
4 44127
MrDeej
157 New Member
Thank you :)
I bookmarked this thread
Aug 20 '07 #2
smith1966
3 New Member
Fantastic Stuff ...
I've been lokking for this info for ages.

One other question tho ...

How do I reference the controls on the individual pages.
eg
Within VBA ... How do I access access "Control-A" on "Page-3" If I have focus set to "Page-1" ?

Thanks In Advance ...
Mar 17 '08 #3
NeoPa
32,573 Recognized Expert Moderator MVP
Smith, this question needs to be asked in the technical forum. This section is for Articles only.

Administrator.
Aug 5 '08 #4
PianoMan64
374 Recognized Expert Contributor
Fantastic Stuff ...
I've been lokking for this info for ages.

One other question tho ...

How do I reference the controls on the individual pages.
eg
Within VBA ... How do I access access "Control-A" on "Page-3" If I have focus set to "Page-1" ?

Thanks In Advance ...
They are all at the form level.

Expand|Select|Wrap|Line Numbers
  1.  
  2. me.controlname
  3.  
  4.  
since you have to have a unique name for each control on the form, that is how you reference each control on the form. It doesn't matter that it is in tab control.

Hope that helps,

Joe P.
Aug 5 '08 #5

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

Similar topics

1
4076
by: DU | last post by:
Assuming you have a typical form built in this manner: <form action="..."> <p><input id="idInputText" name="nameInputText" type="text" size="20"></p> <p><input id="idCheckbox" name="nameCheckbox">optional</p> <p><input id="idRadio1" name="nameRadio">yes<input id="idRadio2" name="nameRadio">no</p> <p><select id="idSelect" name="nameSelect"><option value="a">a</option><option value="b">b</option><option value="c">c</option></select></p>
2
2057
by: eagle | last post by:
How do I access a control, like a placeholder, from another page, or another user control that may be on the same page. For instance, I have a web page with 2 user controls. One user controls contains a placeholder to that will contain any error messages to be displayed. If the first user control creates an error, I want to be able to push that error to the 2nd control to display it at the placeholder. I have tried Dim ctrlError as...
1
1836
by: tmaster | last post by:
Within a class, can I create a property that is a listview? Here's what I tried, but it doesn't seem to work: '------------ create property to give the second form access to the first form's listview: Public Class frmToDoDetail ' (this is the second form)
0
1424
by: Geraldine Hobley | last post by:
Hello I have a problem whereby I have a treeview control on one form called projecttree and I wish to clea the nodes from this control in another form The form that contains the treeview is called projecttree and the form that I wish to clear the node from the tree, (because I'm connecting to a different database) is called frmConnections The forms are on the screen at the same time, and they are of type crownwood docking control ...
10
1422
by: Jack Russell | last post by:
If I know the name of a control can I access it (change its text etc) without looking through all the controls for one with this name? Thanks Jack Russell
1
6985
by: Jeff Lynch | last post by:
I'd like to add the following attributes to the Login control's Login Button to create a CSS rollover effect. How can I access the control's login button from the page's code-behind? LoginButton.Attributes.Add("onmouseover", "this.className = 'buttonsmallover'"); LoginButton.Attributes.Add("onmouseout", "this.className = 'buttonsmall'"); -- Jeff Lynch
5
2765
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> I have the gridview inside of a master page- content hierarchy.
3
2019
ADezii
by: ADezii | last post by:
One frequently asked question at TheScripts is how to set focus/make active a specific Tab on a Tab Control other than clicking on it. Before I provide the answer, I feel as though a little summary information would be most helpful. __1. An individual Tab on a Tab Control is actually a Page Object. For this discussion, we will use the terms Tab/Page interchangeably, however. __2. Each Page Object is a member of the Pages Collection which...
2
2341
by: Mahesh83 | last post by:
Hi In Tabs Control by default it show focus on the First Tab but I want to make Default tab to load is third tab to show Focus on the Form Load Please help me... Cheers
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7451
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.