我是这样的啊,在父窗口里生成一个子窗口啊,
procedure TFramecustomer.Image8Click(Sender: TObject);
var
   m,datafile:string;
   i:integer;
   Framemaintain2:Tframe;
   chejiaid2:string;
begin
       chejiaid2:=Adoquery1.fieldbyname('chejiaid').asstring;
    
      for i:=0 to self.ComponentCount-1 do
        if (self.Components[i] is Tframe) then (self.Components[i] as Tframe).Free;
        with TFramemaintain2.Create(self) do
      begin
        Parent := self;
        Left := 0;
        Top := 0;
        ADOQuery1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DataFile+';Persist Security Info=False';
        ADOQuery1.Active := True;
         ADOQuery1.close;
         Adoquery1.sql.clear;
         Adoquery1.sql.add('select * from T_maintain where chejiaid='''+chejiaid2+'''');
         Adoquery1.open;
         image8.Visible:=true;
        Show;
      end;     // ADOQuery1.close;
  //  ADOQuery1.Active := true;      {
     for i:=0 to self.ComponentCount-1 do
        if (self.Components[i] is Tframe) then (self.Components[i] as Tframe).Free;
     {建立相应的Frame}
     { with TFrameUserList.Create(selft) do
      begin
        Parent := Form2;
        Left := 212;
        Top := 174;
         ADOQuery1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DataFile+';Persist Security Info=False';
         ADOQuery1.Active := true;
      
        Show;
      end;   }end;然后在子窗口里写self.free;出错啊, access voilation address at ***** 'project1.exe' read or ******地址访问错误啊,  是不是指针错误啊,???????????  不懂啊,要怎么改,帮忙啊!!!

解决方案 »

  1.   

    查看一下ADOQUERY1的连接
    ???????????????????不懂啊,ADOQUERY1的连接是对的啊,对了,父窗口也是动态生成的啊,而且,父窗口。子窗口都有adoquery1,不知道有影响吗??
      

  2.   

    我试过了啊,都没有用啊self:=nil  窗体没有任何反映啊,晕~~~~~~~~~~~~~~~~~~~~~~~~~
      

  3.   

    在子窗口的close事件中写:
    Action := caFree;
      

  4.   

    其他需要关闭的地方写 self.close
      

  5.   

    在子窗口的Close事件中写:
    Action := caFree;
    ------------------------------------
    体验速度,体验CSDN新版论坛助手:http://community.csdn.net/Expert/TopicView.asp?id=3108679
      

  6.   

    不行啊,我的思路是这样的啊,我是有个图片啊,  ‘返回’,按它然后返回啊,,keyz(keyz)你说的self.close出现这样的错误啊[Error] Unitmaintain2.pas(465): Undeclared identifier: 'close' 没有这个identifier:啊什么原因啊 ??????????????????
      

  7.   

    什么意思啊
    self.close出现这样的错误啊[Error] Unitmaintain2.pas(465): Undeclared identifier: 'close'
      

  8.   

    self.close出现这样的错误啊[Error] Unitmaintain2.pas(465): Undeclared identifier: 'close'
      

  9.   

    试一试发送WM_CLOSE给Self.handle,然后
    在子窗口的close事件中写:
    Action := caFree;
      

  10.   

    zhujainf(剑锋) 你好啊,我知道你是高手啊,  你能讲的再清楚些嘛??? 我是刚学的啊,你能讲的具体些嘛???谢谢了啊,