with table1 do
begin
tablename:='md1.db';
databasename:='c:/mydata';
end;
对with的项进行多项赋值。
等于
table1.tablename:='md1.db';
table1.databasename:='c:/mydata';
如:
1. User为一record, 有两个域: UserName, UserAge
with User do
begin
UserName:='Delphi';
UserAge:=5;
end;
2.
...
procedure TForm1.FormCreate(Sender: TObject);
begin
with TForm2.create(self) do
try
showmodal
finally
free
end;
end;
...
3.
if sender is TEdit then
with (sender as TEdit) do
text:='hello'
...还有很多, 找本书和例子看看吧