开发者

How can I format a databound textbox as a percentage?

开发者 https://www.devze.com 2023-02-02 20:10 出处:网络
In the properties of my textBox, under DataBinding, I can pull up a dialog to set up all kinds of advanced databinding formatting.

In the properties of my textBox, under DataBinding, I can pull up a dialog to set up all kinds of advanced databinding formatting.

I can set there format for numeric currency, dateTime etc but how can I set for percent?

I mean if I have value 1 I would like to present 100 % if 0,5 then 50 % and s开发者_开发知识库o on


Just use P followed by an optional digit as the format string.

Eg: Console.WriteLine("{0:P2}", 0.6125) will print 61.25%.

0

精彩评论

暂无评论...
验证码 换一张
取 消