Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created April 16, 2011 07:28
Show Gist options
  • Save takeshik/922951 to your computer and use it in GitHub Desktop.
Save takeshik/922951 to your computer and use it in GitHub Desktop.
// this is Form
var textBoxes = this.Controls
.OfType<TextBox>()
.Where(t => t.Name.StartsWith("textBox"))
.OrderBy(t => Int32.Parse(t.Name.Substring("textBox".Length)))
.ToList();
foreach (var _ in textBoxes.Select((t, i) => new { t, i, }))
{
_.t.Text = "This is TextBox #" + _.i + "!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment