ruan

ruan

  • NA
  • 6
  • 0

setting a value to an iterated component

Apr 21 2004 8:05 AM
Hi, I would like to know how to make this work in C#. If you have 2 textboxes, myText1 and myText2 to do the following: private void Page_Load(object sender, System.EventArgs e) { for (int i=0;i<2;i++) { (myText+"i").Text = "this is text "+i; } } I know it will not work, since myText is not a string object, but isn't there something in C# like the eval statement in JavaScript where i could say something like Textbox newText = eval(myText+"i"); newText.Text = "hello"; which would make myText1 equal to hello I hope I am making sense Thanx

Answers (3)