-4

If I have a textbox with the name textbox00 how do I get the data from it by using the name?

1 Answers1

0

You can use Controls.Find() like this:

string ctlToFind = "textbox00";
TextBox tb = Controls.Find(ctlToFind, true).FirstOrDefault() as TextBox;
if (tb != null)
{
    Console.WriteLine(tb.Text);
}
Idle_Mind
  • 38,363
  • 3
  • 29
  • 40