Hi,
See you code below:
int x=27, z=65;
private void button1_Click(object sender, EventArgs e)
{
TextBox textBox2 = new TextBox();
textBox2.Name = "textBox2";
textBox2.Location = new Point(x,z+25);
textBox2.Visible = true;
this.Controls.Add(textBox2);
}
You are adding the code dynamically, correct. Your problem is, you are adding the controls in the same location again and again. Try putting the different location for the buttons each time you are adding. Try this:
int x=27, z=65;
private void button1_Click(object sender, EventArgs e)
{
TextBox textBox2 = new TextBox();
textBox2.Name = "textBox2";
textBox2.Location = new Point(x,z+25);
textBox2.Visible = true;
this.Controls.Add(textBox2);
z += 20;
y += 20;
}
Hope it helps.
--Amit