Click here to Skip to main content
15,888,330 members
Home / Discussions / C#
   

C#

 
GeneralRe: Looping through Controls on a tab page Pin
Martin#17-Jul-07 20:03
Martin#17-Jul-07 20:03 
GeneralRe: Looping through Controls on a tab page Pin
Mike Dimmick17-Jul-07 11:42
Mike Dimmick17-Jul-07 11:42 
GeneralRe: Looping through Controls on a tab page Pin
PIEBALDconsult17-Jul-07 11:49
mvePIEBALDconsult17-Jul-07 11:49 
JokeRe: Looping through Controls on a tab page Pin
BoneSoft17-Jul-07 12:10
BoneSoft17-Jul-07 12:10 
GeneralRe: Looping through Controls on a tab page Pin
PIEBALDconsult17-Jul-07 14:04
mvePIEBALDconsult17-Jul-07 14:04 
GeneralRe: Looping through Controls on a tab page Pin
Mike Dimmick17-Jul-07 20:17
Mike Dimmick17-Jul-07 20:17 
GeneralRe: Looping through Controls on a tab page Pin
PIEBALDconsult18-Jul-07 8:56
mvePIEBALDconsult18-Jul-07 8:56 
AnswerRe: Looping through Controls on a tab page Pin
BoneSoft17-Jul-07 10:48
BoneSoft17-Jul-07 10:48 
Every control, including Form has a property called Controls. And of course in cases like TabControl, controls are nested. So the form will have the TabControl in it's Controls collection, and each TabPage in the TabControl will have whatever is on the tab in it's controls collection. If the IDs you give each control is enough information for you to tell what you're looking at, you should be able to do what you need that way.

// I didn't test this, just typed it out.  It may need to be adjusted.
foreach (Control tab in this.Controls) {
    TabControl t = tab as TabControl;
    if (t == null) { continue; }
    foreach (TabPage p in t.TabPages) {
        foreach (Control cp in p.Controls) {
            if (!(cp is MyControl)) { continue; }
            MyControl mc = cp as MyControl;
            // blah blah blah
        }
    }
}




Try code model generation tools at BoneSoft.com.

QuestionSelect Records From DataGridView Pin
polishprogrammer17-Jul-07 10:08
polishprogrammer17-Jul-07 10:08 
AnswerRe: Select Records From DataGridView Pin
Paul Conrad17-Jul-07 19:11
professionalPaul Conrad17-Jul-07 19:11 
GeneralRe: Select Records From DataGridView Pin
polishprogrammer18-Jul-07 4:11
polishprogrammer18-Jul-07 4:11 
QuestionList View Search Pin
topksharma198217-Jul-07 9:44
topksharma198217-Jul-07 9:44 
AnswerRe: List View Search Pin
BoneSoft17-Jul-07 10:14
BoneSoft17-Jul-07 10:14 
GeneralRe: List View Search Pin
topksharma198217-Jul-07 22:16
topksharma198217-Jul-07 22:16 
GeneralRe: List View Search Pin
BoneSoft18-Jul-07 1:49
BoneSoft18-Jul-07 1:49 
AnswerRe: List View Search Pin
Luis Alonso Ramos17-Jul-07 14:29
Luis Alonso Ramos17-Jul-07 14:29 
GeneralRe: List View Search Pin
topksharma198217-Jul-07 23:04
topksharma198217-Jul-07 23:04 
GeneralRe: List View Search Pin
Luis Alonso Ramos18-Jul-07 5:27
Luis Alonso Ramos18-Jul-07 5:27 
Questioncookies Pin
daku117-Jul-07 9:40
daku117-Jul-07 9:40 
AnswerRe: cookies Pin
dino209417-Jul-07 10:27
dino209417-Jul-07 10:27 
AnswerRe: cookies Pin
Dave Kreskowiak17-Jul-07 10:27
mveDave Kreskowiak17-Jul-07 10:27 
AnswerRe: cookies Pin
Ravi Bhavnani17-Jul-07 17:35
professionalRavi Bhavnani17-Jul-07 17:35 
GeneralRe: cookies Pin
daku117-Jul-07 11:53
daku117-Jul-07 11:53 
GeneralRe: cookies Pin
Dave Kreskowiak17-Jul-07 14:04
mveDave Kreskowiak17-Jul-07 14:04 
GeneralRe: cookies Pin
Paul Conrad17-Jul-07 12:32
professionalPaul Conrad17-Jul-07 12:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.