afzal patel

afzal patel

  • NA
  • 2
  • 526

move contents of dynamic textboxes from one form to another

Sep 30 2016 11:15 AM
I need to move data from textboxes created dynamically from one windows form to another.
The user entered data in textboxes should be displayed as labels in the next windows form.
 plz suggest me the code to transfer the data.
 
textboxes are created using the following code:
private void ButtonOk_Click_1(object sender, EventArgs e)
{
int txtno = int.Parse(TxtNos.Text);
int pointX = 410;
int pointY = 10;
int pointx = 550;
panel2.Controls.Clear();
for (int i = 0; i < txtno; i++)
{
TextBox sub = new TextBox();
TextBox marks = new TextBox();
sub.Text = (i + 1).ToString();
marks.Text = (i + 1).ToString();
sub.Location = new Point(pointX, pointY);
marks.Location = new Point(pointx, pointY);
panel2.Controls.Add(sub);
panel2.Controls.Add(marks);
panel2.Show();
pointY += 30;
}
}
 
 

Answers (2)