一个Form在执行showmodal方法时(此窗体的控件是从另一窗体复制过程来的),出现如下错误信息,"Access violation at address XXXXXX,Read of address 000000,Process stopped", 不知何解。请教各位。

解决方案 »

  1.   

    是不是还没有CREAT呀!~
    代码呢!》?
      

  2.   

    自己检查代码
    用showmessage看看能执行到哪?
      

  3.   

    肯定是没有CREATE,你看看你的工程文件中有没有自动创建该窗体!
      

  4.   

    如果是Form的FormStyle属性为fsMDIChild则不能使用Form.ShowModal,
    而必须使用Form.Show!
    procedure TMainForm.N5Click(Sender: TObject);
    begin
      if Form = nil then
        Form := TForm.Create(Self)
      else Form.Show;
    end;如果Form的FormStyle属性为fsNormal,那么试试下面的方法。procedure TMainForm.N5Click(Sender: TObject);
    begin
      if Form = nil then
      begin
        Form := TForm.Create(Self);
        Form.ShowModal;
      end else Form.ShowModal;
    end;最好在Form的OnClose事件中写入如下代码:
    procedure TForm.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Action := caFree;
      Form := nil;
    end;
      

  5.   

    可能是没有创建窗体就showmodal了
      

  6.   

    窗体的 visible属性要 为false;
      

  7.   

    如果这样 在设计时窗体的 visible属性要 为false;procedure TMainForm.N5Click(Sender: TObject);
    begin
      if Form = nil then
      begin
        Form := TForm.Create(Self);
        Form.ShowModal;
      end else Form.ShowModal;
    end;
      

  8.   

    看你的错误信息应当是由于没有创建。用Show行吗?如果行就不是创建的问题,而是使用了两次ShowModal!