//-- function used to reset the fields background color public void ResetFields() { Control[] Carr = new Control[this.Controls.Count]; this.Controls.CopyTo(Carr, 0); for (int i = 0; i < Carr.Length; i++) { if (Carr[i].GetType().ToString().IndexOf("TextBox") > 0) { Carr[i].BackColor = SystemColors.Window; } } }