I'm creating an application in VS2015 WindowsFormAplication where I need to change the colors of the textbox
when the result is greater than, equal to or less than zero (0).
I'm working as follows:
if (Convert.ToDecimal(tbEntrDiferenca.Text) > 0)
tbEntrDiferenca.BackColor = Color.Green;
if (Convert.ToDecimal(tbEntrDiferenca.Text) < 0)
tbEntrDiferenca.BackColor = Color.Red;
tbEst2016Mat.BackColor = Color.Red;
if (Convert.ToDecimal(tbEntrDiferenca.Text) == 0)
tbEntrDiferenca.BackColor = Color.Yellow;
I'll need to do the same condition in twenty (20) textbox
. Is there an easier way than this?