如何在C#中使用逗号分隔格式(如100,236,563)将文本框格式转换为金钱? [英] how to convert textbox format to money with comma sepration format ( like 100,236,563 ) in c#?

查看:358
本文介绍了如何在C#中使用逗号分隔格式(如100,236,563)将文本框格式转换为金钱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有文本框,我需要用逗号分隔符(例如 12,654,500 )将其格式转换为curency和money格式,任何人都可以帮助我?

  private void txtMuchMoney_TextChanged(object sender,EventArgs e)
{

}


解决方案

使用这个掩码:

  $ 000,000,000 

参考此MSDN文章

lockquote
$ code $货币符号。显示的实际字符将是适合格式提供者的货币符号,由控件的FormatProvider属性确定。




所以,你也可能想要设置FormatProvider属性,如果你没有获得所需的行为。


I have textbox and I need to convert format of that to curency and money format with comma seprator ( like 12,654,500 ) can anybody help me ??

private void txtMuchMoney_TextChanged(object sender, EventArgs e)
{

}

解决方案

Use this mask:

$000,000,000

Refer to this MSDN article for more information on masks.

$ : Currency symbol. The actual character displayed will be the currency symbol appropriate to the format provider, as determined by the control's FormatProvider property.

, : Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the format provider, as determined by the control's FormatProvider property.

So, you might also want to set the FormatProvider property if you not get the desired behavior out-of-the-box.

这篇关于如何在C#中使用逗号分隔格式(如100,236,563)将文本框格式转换为金钱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆