I want to add form controls dynamically to my form from another class which inherits the form class. Everything works fine but it does not add the controls at run time.
Here is my sample code:
namespace Namespace1
{
public partial class Form1 : Form
{
.....
}
.......
}// end of Namespace1
namespace Namespace2
{
public class1:Form1
{
public Button button = new Button();
public void method1()
{
button1.Name="button1";
//flowlayoutcontrol1 is a public control on Form1
flowlayoutcontrol1.Controls.Add(button1);
}
} }