Arrggg…Format String Hell…Hello there,
I am attempting to format a decimal value as a % (percentage).
That is; I want .12 to be displayed and edited as 12%
No matter what I try I cant get it to work :(
I can get it working for display format, but not for the editformat :(
Below is my code
Me.txtDefaultAdminFeePercentage.Properties.DisplayFormat.FormatType =
FormatType.Numeric
Me.txtDefaultAdminFeePercentage.Properties.DisplayFormat.FormatString =
"{0:0%}"
Me.txtDefaultAdminFeePercentage.Properties.EditFormat.FormatType =
FormatType.Numeric
Me.txtDefaultAdminFeePercentage.Properties.EditFormat.FormatString =
"{0:0%}"
Any ideas would be greatly appreciated
Thank you for taking the time to read my post
John
Phillip Taylor - 15 Oct 2007 11:26 GMT
> Arrggg...Format String Hell...Hello there,
>
[quoted text clipped - 18 lines]
> Thank you for taking the time to read my post
> John
Instead of using a textbox you might try using the masked text box
control instead (it should be listed in the components somewhere).
Then set the mask property. I'm sure this kind of thing is ideal for
it's use.
Phill
Rad [Visual C# MVP] - 15 Oct 2007 18:17 GMT
>Arrggg
Format String Hell
Hello there,
>
[quoted text clipped - 18 lines]
>Thank you for taking the time to read my post
>John
The format string you want is {0:p}
That will give you 12.00%
--
http://bytes.thinkersroom.com