473,659 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing all controls on a tabcontrol??

I am using a tabcontrol alled for example:-

TabPage

There are several tabs on this tabcontrol with command buttons on them. I
want to loop through them but the following code does not work:-

For Each ctl in TabPage.Control s ... Next

However if I just loop through controls on one of the tabs - e.g. a tab
called tabFirst this works fine:-

For Each ctl in tabFirst.Contro ls ... Next

How do I get the Controls on all of the tabs??
Thanks

Paul Bromley
Nov 21 '05 #1
2 8346
Paul,

"Paul Bromley" <fl*******@dsl. pipex.com> schrieb:
There are several tabs on this tabcontrol with command buttons on them. I
want to loop through them but the following code does not work:-

For Each ctl in TabPage.Control s ... Next

However if I just loop through controls on one of the tabs - e.g. a tab
called tabFirst this works fine:-

For Each ctl in tabFirst.Contro ls ... Next

How do I get the Controls on all of the tabs??


\\\
For Each tab As TabPage In Me.TabControl1. TabPages
For Each ctr As Control In tab.Controls
...
Next ctr
Next tab
///

Note that this won't find controls which are nested in container controls
placed on the tab pages.

BTW: I would not use the name 'TabPage' for a tab control because the tab
pages are instances of the class 'TabPage', which could be misleading for
the reader.

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

Nov 21 '05 #2
Thanks Herfried,
I suspected that I needed to loop through through the tabpages. I had
foolishly placed:-

For Each ctr As Control In Controls

In my code instead of:-

For Each ctr As Control In tab.Controls
Thanks once again.
Paul Bromley

T

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Paul,

"Paul Bromley" <fl*******@dsl. pipex.com> schrieb:
There are several tabs on this tabcontrol with command buttons on them. I want to loop through them but the following code does not work:-

For Each ctl in TabPage.Control s ... Next

However if I just loop through controls on one of the tabs - e.g. a tab
called tabFirst this works fine:-

For Each ctl in tabFirst.Contro ls ... Next

How do I get the Controls on all of the tabs??


\\\
For Each tab As TabPage In Me.TabControl1. TabPages
For Each ctr As Control In tab.Controls
...
Next ctr
Next tab
///

Note that this won't find controls which are nested in container controls
placed on the tab pages.

BTW: I would not use the name 'TabPage' for a tab control because the tab
pages are instances of the class 'TabPage', which could be misleading for
the reader.

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

Nov 21 '05 #3

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

Similar topics

4
1479
by: Duncan | last post by:
It seems that controls that are in a form's ComponentTray (e.g. ToolTip, ErrorProvider) don't appear on its list of controls (FormName.Controls). Is there any way I can get hold of them?
1
3543
by: Paul Maidment | last post by:
Hi, I am a bit green when it comes to .net development so please excuse me if this question is obvious or has been asked before... I am trying to programmatically access a label control within a datalist footer template using asp/vb.net. I have been searching through the documentation but can only find reference to
6
2244
by: arvee | last post by:
Is there a way to access controls (and their properties) in a user control? The Web Form Designer marks controls as 'Protected' which makes them inaccessable from the host form. If I mark them as Public, I can access them, but the next time the controls are manipulated in the design mode, they are converted back to Protected. Is there an obvious/easy way around this? Thanks.
2
1280
by: Robert Kemp | last post by:
I am creating a non-visible/tray control that monitors other custom controls for changes (among other things). One of the monitored controls is a new textbox that adds functionality to the standard textbox, and includes a variable that points to the monitoring tray control... it works just like the imagelist that is attached to any control that supports imagelists, such as a treeview or listview. Everything is working the way I would like...
0
924
by: Geoff Sullivan | last post by:
Are controls inside a nested master accessible? I have a master (b) which references another master (A). In master (b) I has several ASP controls. On the Page_Load of master (b), I can't seem to reference those ASP controls. In the debugger, it shows that master (b) only contains 1 control in the Controls collection and that single control is a reference to master (a)! The debugger also shows the ASP controls as members of master (b),...
1
2093
by: Dave | last post by:
I have the following ASP.NET 2.0 code (simplified here for ease): <asp:Repeater id="SearchResultsRepeater" runat="server"> <ItemTemplate> <uc:SearchResult ID="SearchResult" ResultObject="<%#Container.DataItem%>" runat="server"> <ButtonsTemplate> <uc:ViewButton ID="ViewButton" ListingReference='<%#Eval("ListingReference")%>' runat="server" /> </ButtonsTemplate>
0
1012
by: khalid sohail | last post by:
hi can any1 help me in accessing controls that exist in datagrid using the javascript.......ordinary that controls are access by the document.getelementById('controlid') mathod but that does not work for the control can any1 tell me the way to access that conrol..................help me as soon as possible i shall b vary thank ful............................. best regards ...
0
1013
by: khalid sohail | last post by:
hi can any1 help me in accessing controls that exist in datagrid using the javascript.......ordinary that controls are access by the document.getelementById('controlid') mathod but that does not work for the control can any1 tell me the way to access that conrol..................help me as soon as possible i shall b vary thank ful............................. best regards khalid sohail
1
933
by: maarif | last post by:
The controls placed over an ASP.NET page can be accessed using following loop: For Each lControl In Page.Controls . . . . . . . . Next BUT this works only in code behind of that particular page. I have another project where I need all these controls BUT not like above loop. I want to access these controls like attributes of a class
2
3042
by: San24 | last post by:
Guys, Let me explain the application I have - Form > Main Tab Control > Main Tab Page > User Control > Sub Tab Control > Sub Tab Page > User Control > Contols/Text Box. Form - The main form Main Tab Control - This contains Main Tab Pages.
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8535
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
8629
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
6181
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
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.