type TForm1 = class(TForm) public aa: string; end; TForm2 = class(TForm) public bb: string; end; procedue TForm1.Button1Click(Sender); begin with TForm2.Create(Application) do try bb:=Self.aa;//[[[[[[[[[[[[[[[[[[[[[[[[[ ShowModal; finally Free; end; end;
uses unit ;
http://expert.csdn.net/Expert/topic/2057/2057314.xml?temp=7.85464E-03
如果取变量就用USES。
你要在form2里用这个变量的话,在Form2前面uses unit1;
就可以调用form1的变量拉
TForm1 = class(TForm)
public
aa: string;
end; TForm2 = class(TForm)
public
bb: string;
end;
procedue TForm1.Button1Click(Sender);
begin
with TForm2.Create(Application) do
try
bb:=Self.aa;//[[[[[[[[[[[[[[[[[[[[[[[[[
ShowModal;
finally
Free;
end;
end;
再传递给另一窗体时,要保证被接收值的窗体一定要先创建。