Re:TDBEdit and masking
Kenny A. Hunt (h...@bolivar.cs.uiowa.edu) wrote:
: I'm using a DBEdit component to view and edit a
: database. There are phone-number and zip-code
: fields that I would like to mask, but can't figure
: out how to do it.
: There seems to be an 'IsMasked' property, but I
: don't know how to actually create the mask.
The TMaskEdit component is provided for use with data values not directly
connected to a field in a table. To provide a mask template for field
values displayed/edited through a data-aware control, such as a TDBEdit,
you will need to set the EditMask property at the TField level. For inst-
ance, for a field called Phone in Table1, where a TField has been created,
the syntax would be:
Table1Phone.EditMask := '!\(999\)000-0000;1;_';
The editing mask !\(999\)000-0000;1;_ is stored into the EditMask prop-
erty as a String. If no TField was created, you can use the Fields property
or the FieldByName method to address the field and its EditMask property:
Table1.FieldByName('PHONE').EditMask := '!\(999\)000-0000;1;_';
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Steve Koterski _/ The opinions expressed here are _/
_/ koter...@borland.com _/ exclusively my own _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/