读书人

gt;gt;关于窗体关闭的有关问题?

发布时间: 2012-02-09 18:22:27 作者: rapoo

>>---------------关于窗体关闭的问题?------------------------------

当窗体不是在一开始就加载的时候,也就是动态产生的:

也就是用如下代码:
if not Assigned(RepLableForm) then RepLableForm.Free;
RepLableForm:=TRepLableForm.Create(self);
RepLableForm.ShowModal;

时,如果在那个窗体中,录入数据后,用判断语句:

if Edit1.Text= ' ' then
begin
ShowMessage( '请输入简写代码 ');
Edit1.SetFocus;
Exit;
end;

-----------------------------------------------

请问:

为什么窗体就消失了?如果用SHOW的方式产生该窗体就不会消失?

如果偶想用ShowModal的方法产生,但又不想窗体在判断时消失的话,有没好的办法?



[解决办法]
if not Assigned(RepLableForm) then RepLableForm.Free;
非得要句?

你取消了!!!
[解决办法]
你的 RepLableForm 上应该有个关闭按钮

把RepLableForm 上那个 关闭按钮 ModalResult 属性设置为 mrNone
[解决办法]
去掉 Exit;

读书人网 >.NET

热点推荐