how to create text box when we click the button and at a time only create one text box and again i click button for create one more text box
it is like button is '+' once we click '+' create one text box and there is no limit is there and similarly how to give different name s to each one
Ankur MistryPosted Jan 12, 2016, 3:29 AM
Rajeesh MenothPosted Jan 12, 2016, 2:45 AM
Raja TPosted Jan 12, 2016, 2:45 AM
{
int txtno = int.Parse(txt1.Text);
int pointX = 30;
int pointY = 40;
panel2.Controls.Clear();
for (int i = 0; i < txtno; i++)
{
TextBox a = new TextBox();
a.Text = (i + 1).ToString();
a.Location = new Point(pointX, pointY);
panel2.Controls.Add(a);
panel2.Show();
pointY += 20;
}
}
catch (Exception)
{
MessageBox.Show(e.ToString());
}