I have a method, which checks if a TextBox is filled, if it is normal, if it is blank, it displays a message on the screen, and it paints the background of the TextBox in yellow, Here comes my doubt, how do I return to the default color?
Currently, to go back, I'm using:
public void limparCorBoxes(Control.ControlCollection controles)
{
//Faz um laço para todos os controles passados no parâmetro
foreach (Control ctrl in controles)
{
//Se o contorle for um TextBox...
if (ctrl is TextBox)
{
((TextBox)(ctrl)).BackColor = System.Drawing.Color.White;
}
}
}
But this method brings me problems, as I have some TextBox that has the parameter ReadOnly = true
, which when used leaves the TextBox with the gray background color, and when I execute the method above, all Textbox are with the white background.