Board index » delphi » how do limit field size

how do limit field size

field type : String
field size in database : 20
I would user can only 19 chars enter this field (in dbgrid and dbedit) and I
Can't using mask

Thanks for any help

 

Re:how do limit field size


Quote
>field type : String
>field size in database : 20
>I would user can only 19 chars enter this field (in dbgrid and dbedit) and I
>Can't using mask

Write an Onkeypress event for the control connected to the field that will deny
a chracter when the Text lenght = 19

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:how do limit field size


On Fri, 8 Jan 1999 18:20:02 +0200, "Faruk gunes"

Quote
<far...@ampyazilim.com.tr> wrote:
>field type : String
>field size in database : 20
>I would user can only 19 chars enter this field (in dbgrid and dbedit) and I
>Can't using mask

Faruk,

You can use the TDBEdit.MaxLength property.  For a TDBGrid you could
override the GetEditLimit method, but since it would involve
subclassing a component, I suppose Brian's suggestion is easier.

Just curious, why can't you use a mask just to limit the number of
chars?

Jan

Other Threads