devxlogo

Formatting data

Formatting data

Question:
When I set the FormatMask property for a data field object, the value of the field is formatted when a user enters data and tabs out of the field. How can I get formatting information to show up while the user is entering data in the field?

Answer:
As you have seen, the FormatMask property is used to format the display of data, not the entry of data.

You could set the DefaultValue of the object to show the formatting information and then use the OnKey() method to process keystrokes and format the object’s value properly.

To see an example of the OnKey() method at work, check out the question on hiding the value of a field for the entry of a password. You might see something in version 2.0 of OPO that might address your particular problem, too.

See also  10 Best Apps to Help You Read More Books in Less Time
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist