How to apply price format on a MaskedTextBox?

400 Views Asked by At

Some example code on how to apply a price format on a MaskedTextBox, the mask at startup would be $0.00 and when typing it begins by replacing the first zero from right to left, which is separating thousands, in winforms, VS 2017. As the image:

enter image description here

1

There are 1 best solutions below

0
D.Kastier On

You can achieve what you want with the NumericUpDown control, and a Label.

NumbericUpDown

NumericUpDown max. value

For this example, I set the follow properties of NumericUpDown to:

DecimalPlaces = 2
ThousandsSeparator = True
Maximum = 100000000
TextAlign = Right