个人觉得多窗体的打开和关闭的代码大都一致。于是希望用一个函数来实现我在主窗体里面写如下代码:procedure TMainForm.BtnGroupClick(sender: TObject);
begin
  if assigned(Currentframe) then
     Currentframe.free;  Case (Sender as TComponent).Tag  of
    1001: Currentframe:=TF_BType.Create(application);
    1002: Currentframe:=TF_UserInfo.Create(application);
  else
    Application.MessageBox('该功能尚未授权使用!','系统提示',mb_iconinformation +mb_ok);
  end;
end;为什么再次打开上次关闭的窗体的时候会出错啊。