Good day! Please tell me how to make a mask for money - a comma every 3 digits and at the end a dot and 2 digits. I tried, it did not work (it is necessary that zeros be automatically put when the last two numbers are empty). Maybe there is some component to work with the money format?

    1 answer 1

    Alternatively, you can make such a mask "999,999,999.99; 1; _", and immediately fill it with zeros. Then, when extracting text from MaskEdit, remove the zeros from the front.

    • Thank you, so certainly not bad. But commas remain, even when the corresponding digits are not filled. Maybe there is some component to work with money? - leklerk
    • I don’t see any problems in editing data on MaskEdit at my discretion. Cutting off extra zeros and commas from the front is done in one procedure / function. If we are too lazy, then this is the simplest example: 1. create a variable of the type string 2. make a cycle from 1 to the number of characters in the text MaskEdit and scroll through each character of the line 3. if the new variable is empty, and in the current symbol MaskEdit come across zeros and commas, then we go further. 4. When the zeros and commas in front of MaskEdit end, start adding characters to your variable. - teanCH
    • See what the problem is. The user can enter 35000, meaning of course 35 thousand, but in the field with a mask, the senior bits will be filled first and it will turn out to be 350,000,000.00. - leklerk
    • And this is the inconvenience of the mask, and they will have to be considered. If I were you, I would take the usual Edit, and make handlers for it. For example, if the user does not specify a penny, then under the necessary condition (exit from the combo box, transfer of control to another element), the number “00” is added to the number. If the user specifies a penny like this ", 1", then add "0" to the end to make the cherished ", 10". And in this spirit ... - teanCH