Processing the display and input of database date fields in Delphi === >>> Main window unit

zhaozj2021-02-17  40

{Main window unit} Unit main;

Interface

else uses ...... {omitted} procedure Table1BirthdayGetText (Sender: TField; var Text: String; DisplayText: Boolean); procedure Table1BirthdaySetText (Sender: TField; const Text: String); private {Private declarations} public {Public declarations} ... ... {} Implementation

{Use the customized unit to come in} Uses dbdateeditmaskTrans;

{$ R * .dfm} ... {Other procedure} procedure tform1.formactivate (sender: TOBJECT); {Set a date field input mask, can be placed in the TField field definition. Begin table1.fieldbyname ('birthday'). Editmask: = '9999 / year 99 / month 99 / day; 1; _'; end;

Procedure TForm1.Table1birddaygetText (Sender: Tfield; Var Text: String; DisplayText: Boolean; Begin DatefieldText (Sender, Text);

Procedure tForm1.table1birddaySettext (Sender: tfield; const text: string); begin if DatefieldSettext (sender, text) = false kiloth; {Conversion is unsuccessful, date illegal} END;

End.

转载请注明原文地址:https://www.9cbs.com/read-30413.html

New Post(0)