Hi,
I have some code which displays in a combobox like this;
combobox.text = myDecimal.ToString("C");
|
The MSDN page says this should be the output;
Console.WriteLine(value.ToString("C")); // Displays ($16,325.62)
|
So does anyone have any idea why im seeing "$16, 325.62" ?? The space is being added after the comma.. which means when i try and parse this string later on back in to a decimal using the following code, it fails;
decimal.Parse(combobox.Text, NumberStyles.Currency);
|
If i manually remove the space while stepping in to the code in debug, it works fine. Otherwise it throws invalid format. I have also tried NumberStyles.Any as well. I can manually remove the space but i dont want to have to go about doing that :-( Any ideas why this is happening?
thanks.
Bruce RoeserPosted Jul 11, 2010, 9:59 PM
private void button1_Click(object sender, EventArgs e) {
double myDecimal = 16325.62;
Console.WriteLine(myDecimal.ToString("C"));
}
I'm getting the following output:
$16,325.62
No spaces are imbedded. This with VS2008.