Click here to Skip to main content
15,071,205 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 3:21
MemberBobJanova29-Nov-12 3:21 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
Blenni29-Nov-12 3:49
MemberBlenni29-Nov-12 3:49 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 6:05
MemberBobJanova29-Nov-12 6:05 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
Blenni29-Nov-12 21:45
MemberBlenni29-Nov-12 21:45 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 23:26
MemberBobJanova29-Nov-12 23:26 
QuestionGetting *all* controls of a form Pin
Dennis Bork28-Nov-12 23:04
MemberDennis Bork28-Nov-12 23:04 
AnswerRe: Getting *all* controls of a form Pin
BobJanova28-Nov-12 23:21
MemberBobJanova28-Nov-12 23:21 
AnswerRe: Getting *all* controls of a form Pin
Richard MacCutchan28-Nov-12 23:24
mveRichard MacCutchan28-Nov-12 23:24 
You need to do recursive searching. If the control you find in your first loop is a panel or any form of 'grouping' control, then call your method again pointing at that control, so you scan all its child controls. This will then continue down through all the trees until you have tested everything, something like:
C#
scanner(Control parent)
{
    foreach (Control c in parent.Controls)
    {
        if (c == c as Label)
        {
            c.ForeColor = Color.Aqua;
        }
        if (c == c as Button)
        {
            c.BackColor = Color.Yellow;
        }
        if (c == c as some_grouping_type)
        {
            scanner(c);
        }
    }
}

// somewhere in your program call the scanner method with:
scanner (Form1.ActiveForm);

One of these days I'm going to think of a really clever signature.

GeneralRe: Getting *all* controls of a form Pin
Dennis Bork3-Dec-12 2:16
MemberDennis Bork3-Dec-12 2:16 
GeneralRe: Getting *all* controls of a form Pin
Richard MacCutchan3-Dec-12 2:27
mveRichard MacCutchan3-Dec-12 2:27 
AnswerRe: Getting *all* controls of a form Pin
J4amieC28-Nov-12 23:25
MemberJ4amieC28-Nov-12 23:25 
AnswerRe: Getting *all* controls of a form Pin
Pete O'Hanlon28-Nov-12 23:27
mvePete O'Hanlon28-Nov-12 23:27 
GeneralRe: Getting *all* controls of a form Pin
J4amieC29-Nov-12 3:22
MemberJ4amieC29-Nov-12 3:22 
GeneralRe: Getting *all* controls of a form Pin
Pete O'Hanlon29-Nov-12 3:24
mvePete O'Hanlon29-Nov-12 3:24 
QuestionC# GUI Controlling An External Device Pin
C-P-User-328-Nov-12 15:25
MemberC-P-User-328-Nov-12 15:25 
AnswerRe: C# GUI Controlling An External Device Pin
OriginalGriff28-Nov-12 23:05
mveOriginalGriff28-Nov-12 23:05 
GeneralRe: C# GUI Controlling An External Device Pin
C-P-User-329-Nov-12 5:33
MemberC-P-User-329-Nov-12 5:33 
GeneralRe: C# GUI Controlling An External Device Pin
OriginalGriff29-Nov-12 5:47
mveOriginalGriff29-Nov-12 5:47 
GeneralRe: C# GUI Controlling An External Device Pin
C-P-User-329-Nov-12 6:18
MemberC-P-User-329-Nov-12 6:18 
GeneralRe: C# GUI Controlling An External Device Pin
C-P-User-329-Nov-12 5:57
MemberC-P-User-329-Nov-12 5:57 
GeneralRe: C# GUI Controlling An External Device Pin
OriginalGriff29-Nov-12 6:17
mveOriginalGriff29-Nov-12 6:17 
GeneralRe: C# GUI Controlling An External Device Pin
C-P-User-329-Nov-12 6:27
MemberC-P-User-329-Nov-12 6:27 
GeneralRe: C# GUI Controlling An External Device Pin
OriginalGriff29-Nov-12 8:09
mveOriginalGriff29-Nov-12 8:09 
GeneralRe: C# GUI Controlling An External Device Pin
C-P-User-329-Nov-12 9:27
MemberC-P-User-329-Nov-12 9:27 
GeneralRe: C# GUI Controlling An External Device Pin
OriginalGriff29-Nov-12 20:22
mveOriginalGriff29-Nov-12 20:22 

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.