-5

I am getting all of the local processes on the computer and putting them inside of a FlowLayoutPanel where you can click the process you want and attach to it.

The problem I am running into is cloning a button so I can put it in the FlowLayoutPanel.
The plan is to make a for loop and loop through the array I get containing all of the processes and make individual buttons containing the names for all of the individual processes that is currently running on the machine.

TL:DR

What is the syntax for cloning a button class?
I cannot find the syntax anywhere talking about cloning anything when it comes to windows forms.

Filburt
  • 17,626
  • 12
  • 64
  • 115
Dwain
  • 1
  • 1

1 Answers1

0

There is no such thing as cloning needed for what you are trying to achieve - simply instantiate new buttons in your loop:

for (int i = 1; i < 5; i++)
{
    // instantiate a new button
    Button btn = new Button();

    // assign the desired property value(s)
    btn.Text = i.ToString();

    // add it to your FlowLayoutPanel
    this.FLPanel1.Controls.Add(btn);
}
Filburt
  • 17,626
  • 12
  • 64
  • 115