string[] rTextBoxes = { textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text}; string[] wTextBoxes = { textBox15.Text, textBox16.Text, textBox17.Text, textBox18.Text, textBox19.Text}; var totalCount = readTextBoxes.Count(); for (int i = 0; i < totalCount; i++) { if (rTextBoxes[i] != wTextBoxes[i]) { foreach (var control in this.Controls) { var textBox = control as TextBox; if (textBox != null) { textBox.ReadOnly = false; } } textBox15.BackColor = Color.Red; textBox16.BackColor = Color.Red; textBox17.BackColor = Color.Red; textBox18.BackColor = Color.Red; textBox19.BackColor = Color.Red; } else { textBox15.BackColor = Color.Green; textBox16.BackColor = Color.Green; textBox17.BackColor = Color.Green; textBox18.BackColor = Color.Green; textBox19.BackColor = Color.Green; } }
if (textBox.InvokeRequired) { textBox.Invoke((MethodInvoker)delegate { textBox.BackColor = Color.Empty; }); }
totalCount
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)