Advertisement
imjyb1008work

利用Control.FindControl來對控制項進行操作

Aug 24th, 2014
2,713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1. //已知Form上面共有三個TextBox Control
  2. //分別為TextBox1 、TextBox2 、TextBox3
  3.  
  4. for (int i = 1; i <= 3; i++)
  5. {
  6.     TextBox tmpTextBox = (TextBox)(this.Controls.Find("textBox" + i, true).FirstOrDefault());
  7.     tmpTextBox.Text = i.ToString();
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement