ComponentOne True DBGrid for WinForms
Data Presentation Techniques / Text Formatting / Input Validation with Built-In Formatting
In This Topic
    Input Validation with Built-In Formatting
    In This Topic

    It is important to note that the NumberFormat property affects only the display of data in the grid. Unless you also specify a value for the EditMask property, True DBGrid for WinForms does not enforce an input template, and the user is free to type anything into the formatted cell. When moving to another cell, the grid will reasonably interprets the user's input value and redisplay the data according to the NumberFormat setting.

    For example, if Medium Date formatting is in effect for a column, a date of Saturday, April 25, 1998, 12:00:00 AM will be displayed as 25-Apr-98 with the day of the week and time ignored. If a user enters July and moves to another row, the grid cannot reasonably interpret the input date value and a trappable error will occur. If the user enters oct 5 or 10/5, the grid will interpret the entered date as October 5, 2009 (that is, the current year is assumed). If the database update is successful, the entered date will be redisplayed as 05-Oct-09, since Medium Date formatting is in effect.

    See Also