Show red when string is negative

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")
 
I

Iv

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;
 
I

Iv

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top