Changing properties of controls that were added at runtime

Posted by user257412 on Stack Overflow See other posts from Stack Overflow or by user257412
Published on 2010-04-18T07:37:27Z Indexed on 2010/04/18 7:53 UTC
Read the original article Hit count: 266

Filed under:
|

I have a form in which several buttons are added at runtime via a 'for' method

 public Form()
 {
 for (int i = 0 ... )
  Button b = new Button() 
  b.text =  (string) i ;
  etc..
  etc..
  }

. now i wish to change the text property of the buttons on a certain event. How can this be accomplished? I have tried a few things but none worked.. since the buttons variables are inside the method , they are not available outside.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms