unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, Grids, DBGrids, ExtCtrls, DBCtrls;
type
TForm1 = class(TForm)
Query1: TQuery;
Query1EmpNo: TIntegerField;
Query1LastName: TStringField;
Query1FirstName: TStringField;
Query1PhoneExt: TStringField;
Query1HireDate: TDateTimeField;
Query1Salary: TFloatField;
DBNavigator1: TDBNavigator;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
procedure Query1PhoneExtChange(Sender: TField);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Query1PhoneExtChange(Sender: TField); //Query1HireDate的OnChange事件也在这
begin
query1PhoneExt.ReadOnly:=Query1HireDate.asvariant<>Null;
query1HireDate.ReadOnly:=Query1PhoneExt.asvariant<>Null;
end;
end.
你试试?