Using visual-studio: Create button during runtime in C#.net? on newest questions tagged visual-studio – Stack Overflow

I know how to create button during runtime.

Button button1 = new Button();

button1.Location = new Point(20,10);
button1.Text = "Click Me";
// adding to groupBox1
groupBox1.Controls.Add(button1);

But the problem is i want to add multiple buttons like this..

for(int i = 1; i < 30; i++) {
Button button[i] = new Button();
// Button customization here...
...
groupBox1.Controls.Add(button[i]);

}

The code above is false code. How can I make this happen true in C#.net? i want to create multiple buttons with button name, button1, button2, button3, button4, …. button30;

See Answers


source: http://stackoverflow.com/questions/4943152/create-button-during-runtime-in-c-net
Using visual-studio: using-visual-studio



online applications demo