Still not displaying $

Can someone please help me by reviewing why the label on visual studio is not displaying currency? Any help is appreciated.

double hours = Convert.ToDouble(textBox1.Text);
double rate = Convert.ToDouble(textBox2.Text);
double grosspay = hours * rate;

string.Format("{0:c}", label9.Text);
label9.Text = grosspay.ToString();

Answers


I suppose that you want to assign the result of string.Format to your label text

label9.Text = string.Format("{0:C}", grosspay)

But working with currency values is usually done using the decimal datatype

decimal hours = Convert.ToDecimal(textBox1.Text);
decimal rate = Convert.ToDecimal(textBox2.Text);
decimal grosspay = hours * rate;
label9.Text = string.Format("{0:C}", grosspay)

When should I use double instead of decimals?


Need Your Help

PHP MYSQL configuration for handling case insensivity in table names

php mysql case-sensitive rds

In my application database some of the tables are names in lowercase letters and some are in upper case. I want to male my database to run queries via PHP without considering the case of tables.

Jersey Client thrown NullPointerException on Android

android nullpointerexception jersey

I'm trying to consume an atom feed using the jersey-client library but not having much luck. This is the code I'm using: