Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String.Format
Message
 
 
To
18/02/2013 12:13:03
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:
01566290
Views:
39
0m,
> 1m
> };
>
> foreach (decimal x in values)
> Console.WriteLine("{0,20:$#,##0.00}", x);
>
>
> StringBuilder sb = new StringBuilder();
> sb.AppendFormat("{0,20:$#,##0.00}", 11211105.99m);
> Console.WriteLine(sb.ToString());
> Console.ReadLine();
> }
>
>
>
>

Doesn't matter what I try I am getting one of the two errors: "Input string was not in the correct format" or "Format specification is invalid".

Do you see what I am doing wrong or how can I figure this out?
            displayString.AppendFormat("{0}  {1}   {2}{3}   {4D16}{5D16}  {6}  {7}{3}{3}", 
                                            Convert.ToDecimal(row["extension"]), Convert.ToDateTime(row["date_time"]), message, Environment.NewLine,
                                            row["sale_no"].ToString(), row["trans_no"].ToString(), 
                                            row["operator"].ToString(), row["salespoint"].ToString());
                                    }
                                    displayString.AppendLine("------------");
                                    displayString.AppendFormat("{0C}{2}{1C}  Against This Sale{2}", balance, saleTotal, Environment.NewLine);
                                    messageText = displayString.ToString();
If I remove D16 from above it seems to pass that line OK.

The VFP code is
 scan
               lvRetVal=lvRetVal+;
                  transform(extension, '$,$$$,$$9.99')+'  '+;
                  transform(date_time)+'  '+;
                  padr(iif(department='**TRANS** ', message, department+'/'+category+'/'+item),32)+' '+;
                  chr(13)+chr(10)+;
                  '  '+transform(sale_no, '9999999999999999')+transform(trans_no, '9999999999999999')+' '+;
                  operator+' '+;
                  salespoint+chr(13)+chr(10)+chr(13)+chr(10)
            endscan
            lvRetVal=lvRetVal+;
               '------------'+chr(13)+chr(10)+;
               transform(lnInvBal, '$,$$$,$$9.99')+chr(13)+chr(10)+;
               transform(lnThisSale, '$,$$$,$$9.99')+'  Against This Sale'+chr(13)+chr(10)
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