I am trying to make custom forms with unique sets of controls on each form... I can create the dynamic form, but I can't seem to put any controls on it..
using (Form formA = new Form())
{
Button btn = new Button();
formA.Text = "Form A";
formA.Name = "FormA";
this.MaximizeBox = false;
this.MinimizeBox = false;
this.BackColor = Color.White;
this.ForeColor = Color.Black;
this.Size = new System.Drawing.Size(155, 265);
this.Text = "Run-time Controls";
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.StartPosition = FormStartPosition.CenterScreen;
formA.Show();
formA.Controls.Add(btn);
}
The form creates ok, but no luck on the buttons... (I edited the code displayed here, to make it easier to see what I am trying to do, but my form still destroys itself as soon as it is created. I have no idea why.