Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AppendFormat
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
AppendFormat
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01565543
Message ID:
01565543
Vues:
57
Hi everybody,

I am wondering what is the correct syntax for fomatting integer values in the C# to appear right justfied to predefined number of spaces?

Here is my code
 location = (String)row["location"];
                                onHand = Convert.ToInt32(row["on_hand"]);
                                displayString.AppendFormat("  {0,-10} {1:N0}{2}", location, onHand, Environment.NewLine);
which is supposed to simulate this VFP code
lvRetVal=lvRetVal+'  '+padr(location,10)+' '+transform(on_hand, '999,999,999')+chr(13)+chr(10)
Do you know how should I adjust the above?

I looked at this page in MSDN
http://msdn.microsoft.com/en-us/library/vstudio/system.globalization.numberformatinfo.numbergroupsizes(v=vs.100).aspx

but still don't understand

Thanks a lot in advance.

UPDATE. I figured this out and visually my results look the same, but UnitTest is still failing.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform