private void button1_Click(object sender, EventArgs e)
{
foreach (var textbox in Controls.Cast<object>()
.Select(control => control as TextBox)
.Where(textbox => textbox != null))
{
var value = 0;
if(Int32.TryParse(textbox.Text, out value))
{
if (value % 2 == 0)
{
textbox.BackColor = Color.Green;
}
}
else
{
// TODO: display invalid textbox value
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.