> Hello,
>
[quoted text clipped - 7 lines]
> Thanks
> EitanB
Experiment with something like:
String.Format("{0,-7:0.00}", floatVar)
A bit unsure if that 7 should be positive or negative, but one is
left-aligned, the other is right, and thus padded to be 7 characters.
I think you can use :G2 or a similar syntax as well, to use a format
more in line with your regional settings, just with two decimals.
If the above example doesn't work, dig into the String.Format function
and if you follow the links you'll find something about the format
characters for floating point values.

Signature
Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Arne Vajhøj - 27 Jan 2008 03:00 GMT
>> I have a float point variable defined as: "float floatVar" with the
>> value of "12.3". I would like to format it using floatVar.ToString()
[quoted text clipped - 7 lines]
>
> A bit unsure if that 7 should be positive or negative,
positive
> I think you can use :G2 or a similar syntax as well,
:F2
> If the above example doesn't work, dig into the String.Format function
> and if you follow the links you'll find something about the format
> characters for floating point values.
http://blog.stevex.net/index.php/string-formatting-in-csharp/ is
better than the MS docs in my opinion.
Arne
A really simple way would be to use something like...
floatVar.ToString("0.00").PadLeft(7)

Signature
BlackWasp
www.blackwasp.co.uk
> Hello,
>
[quoted text clipped - 8 lines]
> Thanks
> EitanB

Signature
loralosangeles
> Hello,
>
[quoted text clipped - 7 lines]
> Thanks
> EitanB
Duy Lam - 13 Apr 2008 12:06 GMT
You can check this link for detail:
http://msdn2.microsoft.com/en-us/library/0c899ak8(VS.85).aspx
floatVar.ToString("0000.00") --> 0012.30

Signature
Thanks,
Duy Lam Phuong