问题
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)
{
}
回答1:
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.
回答2:
Use MaskedTextbox
and set the Mask
property to 00,0000,000
.
回答3:
How about using a MaskedTextBox instead
https://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask(v=vs.110).aspx
the mask property value should simply be 00,0000,000
来源:https://stackoverflow.com/questions/35722882/how-to-convert-textbox-format-to-money-with-comma-sepration-format-like-100-23