我想在双击From2 中DBgrid2的数据时  把双击中的数据车间名称赋给From1中DBgrid中的车间名称
怎么写啊

解决方案 »

  1.   

    问题是双击From2 里的DBgrid  From2窗体会自动关闭1、把第二个窗体以Showmodal的方式打开; 
    2、第二个窗体定义品号,品名,规格三个只读属性,完成Get方法 
    3、第一个窗体按钮事件里面写 
    第二个窗体假设为form2,第一个窗体的DBGrid关联的数据集假设为AdoQuery1 
    form2 :=Tform2.Create; 
    if(form2.ShowModal = mrOK) then 
    begin 
    AdoQuery1.Edit; 
    AdoQuery1.fieldbyName(品名).Asstring:=form2.品名;//逐个给字段赋值; 
    ................ 
    AdoQuery1.Post; 
    end; 
    form2.free; 我搜到这个方法  但我不知道2中的完成Get方法是什么
      

  2.   


      TForm2 = class(TForm)
      private
        function GetPrdCode: string;
        function GetPrdName: string;
        function GetPrdStds: string;
        { Private declarations }
      public
        { Public declarations }
        property PrdCode : string read GetPrdCode;
        property PrdName : string read GetPrdName;
        property PrdStds : string read GetPrdStds;
      end;var
      Form2: TForm2;implementation{$R *.dfm}{ TForm2 }function TForm2.GetPrdCode: string;
    begin
      Result := '品号';
    end;function TForm2.GetPrdName: string;
    begin
      Result := '品名';
    end;function TForm2.GetPrdStds: string;
    begin
      Result := '规格';
    end;