I am writing some code for a bank and have written a method so that if the balance becomes negative, the forecolor of the text is displayed in red.
Expand|Select|Wrap|Line Numbers
- void UpdateBalanceDisplay(decimal newValue)
- {
- balanceValueLabel.Text = newValue.ToString();
- if (newValue < 0)
- {
- balanceValueLabel.ForeColor = Color.Red;
- }
- else
- {
- balanceValueLabel.ForeColor = Color.Black;
- }
- }
I have tried just writing
Expand|Select|Wrap|Line Numbers
- UpdateBalanceDisplay();
I cant figure out how to get this to work, or what needs changing.