Matt Biggs
Matt Biggs

Reputation: 177

Make sure number is entered in specific way in EditBox

Is there a way to make sure that numbers are entered into an EditBox in a specific format? ie when someone types 11 it adds a . after it so if someone types 1124 it will recorrect when it gets to the end of the second 1 and adds a . making it 11.24. This is intended for currency. This is made for an TEdit Thanks

Upvotes: 1

Views: 1775

Answers (2)

Ken White
Ken White

Reputation: 125708

The easiest way is to use a TMaskEdit for this; it's what it was designed to do.

MaskEdit1.EditMask := '00.00';  // requires two digits before and after
                                // the decimal point

See the documentation for TEditMask for more information about the types of mask characters you can use.

Upvotes: 2

David
David

Reputation: 117

Yes, the "mask" property. Check help.

Upvotes: -1

Related Questions