procedure TForm1.Edit1Change(Sender: TObject);
begin
if (Sender as TEdit).Name='Edit1' then
begin
edit2.text:=edit1.text;
end;
if (Sender as TEdit).Name='Edit2' then
begin
edit1.text:=edit2.text;
end;
end;
Edit2的Change事件也指定为procedure TForm1.Edit1Change(Sender: TObject);
这样,不论哪各Edit 改变,另外一个都同步改变!
怎么在dbedit中不行?
if (Sender as TdbEdit).Name='dbEdit1' then
begin
dbedit2.text:=dbedit1.text;
end;
if (Sender as TdbEdit).Name='dbEdit2' then
begin
dbedit1.text:=dbedit2.text;
end;
程序已作出修改,但在dbedit中怎么不行呢?
if (Sender as TdbEdit).Name='DBEdit1' then//<<<<<<<<<<<<<名字大小写一致
begin
dbedit2.text:=dbedit1.text;
end;
if (Sender as TdbEdit).Name='DBEdit2' then//<<<<<<<<<<<<<名字大小写一致
begin
dbedit1.text:=dbedit2.text;
end;