I want to make function work :
int a = Convert.ToInt32(tb[0].Text);
After i click :
button1
How to update textbox value after button 1 click?
//My Code
private void somefunction(){
TextBox[] tb = new TextBox[2];
for (int i = 0; i <= 1; i++)
{
tb[i] = new TextBox();
tb[i].Name = "textBox" + i;
tb[i].Location = new Point(50 * i, 10);
tb[i].Size = new System.Drawing.Size(20, 15);
this.Controls.Add(tb[i]);
}
//this code is static, how to make it update on click?
int a, b;
a = Convert.ToInt32(tb[0].Text);
b = Convert.ToInt32(tb[1].Text);
}
// click event
private void button1_Click(object sender, EventArgs e){}
1 Answer