Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
QuestionInput text function Pin
AndrusM21-Aug-07 6:18
AndrusM21-Aug-07 6:18 
AnswerRe: Input text function Pin
snorkie21-Aug-07 7:15
professionalsnorkie21-Aug-07 7:15 
QuestionHow to Insert User Control into DataGrid Cell ? Pin
ArunkumarSundaravelu21-Aug-07 6:14
ArunkumarSundaravelu21-Aug-07 6:14 
AnswerRe: How to Insert User Control into DataGrid Cell ? Pin
Hessam Jalali21-Aug-07 9:52
Hessam Jalali21-Aug-07 9:52 
GeneralRe: How to Insert User Control into DataGrid Cell ? Pin
ArunkumarSundaravelu22-Aug-07 4:11
ArunkumarSundaravelu22-Aug-07 4:11 
QuestionBindingList based on array Pin
AndrusM21-Aug-07 6:12
AndrusM21-Aug-07 6:12 
Questionbrowse through elemnts of container / subscribe event Pin
ezazazel21-Aug-07 6:11
ezazazel21-Aug-07 6:11 
AnswerRe: browse through elemnts of container / subscribe event Pin
Hessam Jalali21-Aug-07 9:03
Hessam Jalali21-Aug-07 9:03 
you can use recursive method (as deep first search or stack search)

it would be somewhat like this
void AssociateClick(Control starterControl)
{
    if(starterControl==null)return;

    foreach(Control c in starterControl.Controls)
    {
        if(c is Button)
        c.Click+=new EventHandler(c_Click);
        AssociateClick(c);
    }
}

void c_Click(object sender, EventArgs e)
{
    //just for testing
    MessageBox.Show((sender as Button).Name);
}


if you pass the form as starter it would iterate in all controls and if iterated control is a button the c_Click method would be associated to that

and of course it can be implemented with other methods like Breadth search (with Q) but maybe recursive is the easiest way in this case

hope the post would be useful

good luck Smile | :)
GeneralRe: browse through elemnts of container / subscribe event Pin
ezazazel21-Aug-07 21:43
ezazazel21-Aug-07 21:43 
QuestionWriting byte stream Pin
gauthee21-Aug-07 5:38
gauthee21-Aug-07 5:38 
AnswerRe: Writing byte stream Pin
Luc Pattyn21-Aug-07 5:48
sitebuilderLuc Pattyn21-Aug-07 5:48 
QuestionThread Synchronization Pin
topksharma198221-Aug-07 4:14
topksharma198221-Aug-07 4:14 
AnswerRe: Thread Synchronization Pin
Luc Pattyn21-Aug-07 5:27
sitebuilderLuc Pattyn21-Aug-07 5:27 
QuestionApplication terminates when window gets closed Pin
MarioMARTIN21-Aug-07 3:59
MarioMARTIN21-Aug-07 3:59 
AnswerRe: Application terminates when window gets closed Pin
MarioMARTIN21-Aug-07 5:07
MarioMARTIN21-Aug-07 5:07 
GeneralRe: Application terminates when window gets closed Pin
Not Active21-Aug-07 5:44
mentorNot Active21-Aug-07 5:44 
GeneralRe: Application terminates when window gets closed Pin
MarioMARTIN21-Aug-07 5:47
MarioMARTIN21-Aug-07 5:47 
GeneralRe: Application terminates when window gets closed Pin
Not Active21-Aug-07 11:03
mentorNot Active21-Aug-07 11:03 
GeneralRe: Application terminates when window gets closed Pin
MarioMARTIN21-Aug-07 19:30
MarioMARTIN21-Aug-07 19:30 
GeneralRe: Application terminates when window gets closed Pin
Not Active22-Aug-07 0:21
mentorNot Active22-Aug-07 0:21 
AnswerRe: Application terminates when window gets closed Pin
Luc Pattyn21-Aug-07 5:52
sitebuilderLuc Pattyn21-Aug-07 5:52 
GeneralRe: Application terminates when window gets closed Pin
MarioMARTIN21-Aug-07 6:00
MarioMARTIN21-Aug-07 6:00 
GeneralRe: Application terminates when window gets closed Pin
Luc Pattyn21-Aug-07 6:23
sitebuilderLuc Pattyn21-Aug-07 6:23 
AnswerRe: Application terminates when window gets closed Pin
MarioMARTIN21-Aug-07 6:19
MarioMARTIN21-Aug-07 6:19 
GeneralRe: Application terminates when window gets closed Pin
Martin#21-Aug-07 8:17
Martin#21-Aug-07 8:17 

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.