I will add another possiblity.
When you create your textbox, you can attach a handler to the
TextChanged
event to keep an updated variable:
public void dynamic()
{
TextBox txt = new TextBox();
...
txt.TextChanged += new EventHandler(System.EventHandler(this.txt_TextChanged));
...
}
string yourText = string.Empty;
private void txt_TextChanged(object sender, EventArgs e)
{
yourText = (sender as TextBox).Text;
}
Choose the solution you prefer ;)