Ali.Ghzd
Ali.Ghzd

Reputation: 319

how to convert textbox format to money with comma sepration format ( like 100,236,563 ) in c#?

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)
{

}

Upvotes: 0

Views: 532

Answers (3)

Fᴀʀʜᴀɴ Aɴᴀᴍ
Fᴀʀʜᴀɴ Aɴᴀᴍ

Reputation: 6251

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.

Upvotes: 1

James Dev
James Dev

Reputation: 3009

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

Upvotes: 0

Olivarsham
Olivarsham

Reputation: 1731

Use MaskedTextbox and set the Mask property to 00,0000,000.

Upvotes: 0

Related Questions