Click here to Skip to main content
15,902,276 members
Home / Discussions / C#
   

C#

 
AnswerRe: each control in form Pin
Dave Kreskowiak21-May-07 9:51
mveDave Kreskowiak21-May-07 9:51 
AnswerRe: each control in form Pin
Not Active21-May-07 9:52
mentorNot Active21-May-07 9:52 
AnswerRe: each control in form [modified] Pin
Dave Herren21-May-07 10:01
Dave Herren21-May-07 10:01 
GeneralRe: each control in form Pin
DoomedOne21-May-07 10:04
DoomedOne21-May-07 10:04 
AnswerRe: each control in form Pin
Mundo Cani21-May-07 10:10
Mundo Cani21-May-07 10:10 
GeneralRe: each control in form Pin
Luc Pattyn21-May-07 12:26
sitebuilderLuc Pattyn21-May-07 12:26 
GeneralRe: each control in form Pin
Mundo Cani21-May-07 18:25
Mundo Cani21-May-07 18:25 
AnswerRe: each control in form Pin
Martin#21-May-07 11:02
Martin#21-May-07 11:02 
Hello,

I mostely prefere to cast direct to the class I'm checking on, cause often a member of this class is on interest.

CheckBox cb = c as CheckBox;
if(cb!=null)

A recursive method would check the "Controls" property of the Control instance c.
RecursiveMethod(this.Controls);
 
private void RecursiveMethod(ControlsCollection cc)
{
    if(cc!=null)
    {
       foreach(Control c in cc)
       {
          CheckBox cb = c as CheckBox;
          if(cb!=null)
          {
              //Do stuff
          }
          else
          {
              RecursiveMethod(c.Controls);
          }
       }
    }
}

Hope it helps!

All the best,

Martin
Questionuse other name of class Pin
abedo198221-May-07 9:26
abedo198221-May-07 9:26 
AnswerRe: use other name of class Pin
Dave Kreskowiak21-May-07 9:36
mveDave Kreskowiak21-May-07 9:36 
GeneralRe: use other name of class Pin
abedo198221-May-07 9:47
abedo198221-May-07 9:47 
GeneralRe: use other name of class Pin
Dave Kreskowiak21-May-07 10:05
mveDave Kreskowiak21-May-07 10:05 
AnswerRe: use other name of class Pin
irishdunn21-May-07 9:47
irishdunn21-May-07 9:47 
GeneralRe: use other name of class Pin
Giorgi Dalakishvili21-May-07 10:22
mentorGiorgi Dalakishvili21-May-07 10:22 
GeneralRe: use other name of class Pin
led mike21-May-07 10:35
led mike21-May-07 10:35 
QuestiondataMemember reference row in table Pin
irishdunn21-May-07 9:02
irishdunn21-May-07 9:02 
AnswerRe: dataMemember reference row in table Pin
DoomedOne21-May-07 9:15
DoomedOne21-May-07 9:15 
GeneralRe: dataMemember reference row in table Pin
irishdunn21-May-07 9:18
irishdunn21-May-07 9:18 
QuestionHELP Pin
irishdunn21-May-07 9:49
irishdunn21-May-07 9:49 
AnswerRe: HELP Pin
SimulationofSai21-May-07 10:28
SimulationofSai21-May-07 10:28 
QuestionRe: HELP Pin
irishdunn22-May-07 4:45
irishdunn22-May-07 4:45 
Questionvb.net code to csharp Pin
raj51021-May-07 8:51
raj51021-May-07 8:51 
AnswerRe: vb.net code to csharp Pin
Not Active21-May-07 8:53
mentorNot Active21-May-07 8:53 
GeneralRe: vb.net code to csharp Pin
Dave Kreskowiak21-May-07 9:32
mveDave Kreskowiak21-May-07 9:32 
GeneralRe: vb.net code to csharp Pin
raj51021-May-07 9:42
raj51021-May-07 9:42 

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.