S
Shayer
Hello
I want to add some dynamic control in the win form when i press a button
I write the following line of code. But the problem is instead of displaying
10 textbox it display 9 textboxes.But it display another textbox when i hit
the button again. Can any one pls give me any solution of it. Anyother
alternative solution is appriciable as well.
Thanks
private void btnProcessNow_Click(object sender, System.EventArgs e)
{
int x=750;
int y=300;
for(int i=0;i<10;i++)
{
this.SuspendLayout();
this.grpFieldPanel.SuspendLayout();
TextBox a=new TextBox();
a.Anchor = (System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Right);
a.Location= new System.Drawing.Point(x,y);
a.Name="a"+i;
a.Size = new System.Drawing.Size(100,20);
y=y+30;
this.grpFieldPanel.SendToBack();
this.grpFieldPanel.Controls.Add(a);
this.Controls.Add(a);
this.grpFieldPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}
I want to add some dynamic control in the win form when i press a button
I write the following line of code. But the problem is instead of displaying
10 textbox it display 9 textboxes.But it display another textbox when i hit
the button again. Can any one pls give me any solution of it. Anyother
alternative solution is appriciable as well.
Thanks
private void btnProcessNow_Click(object sender, System.EventArgs e)
{
int x=750;
int y=300;
for(int i=0;i<10;i++)
{
this.SuspendLayout();
this.grpFieldPanel.SuspendLayout();
TextBox a=new TextBox();
a.Anchor = (System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Right);
a.Location= new System.Drawing.Point(x,y);
a.Name="a"+i;
a.Size = new System.Drawing.Size(100,20);
y=y+30;
this.grpFieldPanel.SendToBack();
this.grpFieldPanel.Controls.Add(a);
this.Controls.Add(a);
this.grpFieldPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}