Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String.Format
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01566272
Message ID:
01566287
Views:
41
>>See http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx and http://msdn.microsoft.com/en-us/library/0c899ak8.aspx.
>>
>>I would probably just use "C" as the format. If you need a custom format, I would try "$#,##0.00".
>
>Yes. That "c" will use your regional currency format.
>
>Michel's answer will work if you have to support multiple currency formats for multiple cultures.

Do you see what is wrong here
displayString.AppendFormat("{0C}  {1}   {2}{3}   {4D16}{5D16}  {6}  {7}{3}{3}", 
                                            Convert.ToDecimal(row["extension"]), Convert.ToDateTime(row["date_time"]), message, Environment.NewLine,
                                            Convert.ToDecimal(row["sale_no"]), Convert.ToDecimal(row["trans_no"]), 
                                            row["operator"].ToString(), row["salespoint"].ToString());
I am getting Format Specifier was invalid.

System.FormatException was caught
HResult=-2146233033
Message=Input string was not in a correct format.
Source=mscorlib
StackTrace:
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.Text.StringBuilder.AppendFormat(String format, Object[] args)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform