W
weibinggui
Unregistered / Unconfirmed
GUEST, unregistred user!
我一共有三个窗体,Main,Form1,Form2,<br>我现在要实现的是,在MAIN上动态创建Form1,FROM1上有一个EDIT1,创建之后,在FROM1点击按钮动态创建Form2,然后在FROM2上点按钮,能对动态创建的FORM1上的EDIT1进行赋值.<br>请问大家是如何处理这种对动态创建的窗体进行赋值的,分不多,请大家帮帮忙.<br>我这样做是错的.<br>Main创建FORM1<br>procedure TMain.Button1Click(Sender: TObject);<br>var<br> NewForm:Tform1;<br>begin<br> newform:=Tform2.Create(Application)<br> newform.Name :='form1';<br> try<br> newform.ShowModal ;<br> finally<br> newform.Free;<br> end;<br>end;<br><br>FORM1 创建FORM2<br>var<br> NewForm:Tform2;<br>begin<br> newform:=Tform2.Create(Application);<br> newform.Name :='form2';<br> try<br> newform.ShowModal ;<br> finally<br> newform.Free;<br> end;<br>end;<br><br>FROM2的点击事件.<br>form1.Edit1.Text :='123';<br> close;<br><br>出错<br><br>---------------------------<br>Debugger Exception Notification<br>---------------------------<br>Project Project2.exe raised exception class EAccessViolation with message 'Access violation at address 0044F026 in module 'Project2.exe'. Read of address 000002FC'. Process stopped. Use Step or Run to continue.<br>---------------------------<br>OK Help <br>---------------------------