NullDatesForm.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:2k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit NullDatesForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   Db, StdCtrls, Mask, DBCtrls, DBTables, ExtCtrls, Grids, DBGrids;
  6. type
  7.   TForm1 = class(TForm)
  8.     Table1: TTable;
  9.     Table1OrderNo: TFloatField;
  10.     Table1CustNo: TFloatField;
  11.     Table1SaleDate: TDateTimeField;
  12.     Table1ShipDate: TDateTimeField;
  13.     Table1EmpNo: TIntegerField;
  14.     Table1ShipToContact: TStringField;
  15.     Table1ShipToAddr1: TStringField;
  16.     Table1ShipToAddr2: TStringField;
  17.     Table1ShipToCity: TStringField;
  18.     Table1ShipToState: TStringField;
  19.     Table1ShipToZip: TStringField;
  20.     Table1ShipToCountry: TStringField;
  21.     Table1ShipToPhone: TStringField;
  22.     Table1ShipVIA: TStringField;
  23.     Table1PO: TStringField;
  24.     Table1Terms: TStringField;
  25.     Table1PaymentMethod: TStringField;
  26.     Table1ItemsTotal: TCurrencyField;
  27.     Table1TaxRate: TFloatField;
  28.     Table1Freight: TCurrencyField;
  29.     Table1AmountPaid: TCurrencyField;
  30.     Label1: TLabel;
  31.     DBEdit1: TDBEdit;
  32.     DataSource1: TDataSource;
  33.     Label2: TLabel;
  34.     DBEdit2: TDBEdit;
  35.     Label3: TLabel;
  36.     DBEdit3: TDBEdit;
  37.     Label4: TLabel;
  38.     DBEdit4: TDBEdit;
  39.     Label5: TLabel;
  40.     DBEdit5: TDBEdit;
  41.     DBNavigator1: TDBNavigator;
  42.     DBGrid1: TDBGrid;
  43.     procedure Table1ShipDateGetText(Sender: TField; var Text: String;
  44.       DisplayText: Boolean);
  45.     procedure Table1ShipDateSetText(Sender: TField; const Text: String);
  46.   private
  47.     { Private declarations }
  48.   public
  49.     { Public declarations }
  50.   end;
  51. var
  52.   Form1: TForm1;
  53. implementation
  54. {$R *.DFM}
  55. procedure TForm1.Table1ShipDateGetText(Sender: TField;
  56.   var Text: String; DisplayText: Boolean);
  57. begin
  58.   if Sender.IsNull then
  59.     Text := '<undefined>'
  60.   else
  61.     Text := Sender.AsString;
  62. end;
  63. procedure TForm1.Table1ShipDateSetText(Sender: TField;
  64.   const Text: String);
  65. begin
  66.   if Text = '' then
  67.     Sender.Clear
  68.   else
  69.     Sender.AsString := Text;
  70. end;
  71. end.