如何将TextBox对象传递给textBox1_TextChanged方法?
public void textBox1_TextChanged(object sender, EventArgs e)
{
//I would like to do something like string value = tb.Text;
}
//method for creating TextBox on button click, than firing event to save value
//from user input on TextChanged
public void button1_Click(object sender, EventArgs e)
{
TextBox tb = new TextBox();
this.Controls.Add(tb);
tb.BringToFront();
tb.Click += new System.EventHandler(textBox1_TextChanged);
}
我知道这是基本的,但我是新手。 谢谢你的帮助。