Show red when string is negative

  • Thread starter Thread starter DavidC
  • Start date Start date
D

DavidC

I have a ListView control where I am building and formatting labels in a
footer row. I am using the .ToString() method and would like to have
negative dollar amounts show in red. My code for setting the labels are as
follows. Thanks.

lbl.Text = (dblBudgetMo7 - dblExpMo7).ToString("c")
 
DavidC said:
I have a ListView control where I am building and formatting labels in a
footer row. I am using the .ToString() method and would like to have
negative dollar amounts show in red. My code for setting the labels are as
follows. Thanks.

lbl.Text = (dblBudgetMo7 - dblExpMo7).ToString("c")

if (dblBudgetMo7 - dblExpMo7 < 0)
label1.ForeColor = Color.Red;
 
DavidC said:
I have a ListView control where I am building and formatting labels in a
footer row. I am using the .ToString() method and would like to have
negative dollar amounts show in red. My code for setting the labels are as
follows. Thanks.

lbl.Text = (dblBudgetMo7 - dblExpMo7).ToString("c")

if (dblBudgetMo7 - dblExpMo7 < 0)
label1.ForeColor = Color.Red;
 
Back
Top