storing values of multiple dynamic textboxes to array
textboxes are generated dynamically
public void createtxtbox(int d)
{
int x = 0;
int y = 0;
txtbox = new TextBox[d*d];
for (int u = 0; u < txtbox.Count(); u++)
{
txtbox[u] = new TextBox();
}
for (int i = 0; i < txtbox.Length; i++)
{
int name = i + 1;
txtbox[i].Name = "TXT" + name.ToString();
txtbox[i].Location = new Point(42 + (x * 31), 47 + (y * 21));
txtbox[i].Visible = true;
txtbox[i].Size = new Size(30, 20);
txtbox[i].MaxLength = 1;
txtbox[i].TextAlign = HorizontalAlignment.Center;
this.Controls.Add(txtbox[i]);
x++;
if (x == d)
{
x = 0; y++;
}
}
}
in the form user inputs values into them and would be stored later in an
array at exit
the only way I know of storing textbox values to string
txtbx = textBox.Text
No comments:
Post a Comment