什么意思?
什么代码?
我copy运行创建窗体看不到什么东西,关闭后delphi死了。

解决方案 »

  1.   

    .....  for I := 0 to M - 1 do
        for J := 0 to N - 1 do
          with TEdit.Create(mParent) do begin
            Name := 'Edit'+IntToStr(i)+'_'+IntToStr(j);   // Give it a Name
            Parent := mParent;
            Left := Width * I;
            Top := Height * J;
          end;   .....读i行j列Edit的数据:
      s := TEdit(FindComponent('Edit'+IntToStr(i)+'_'+IntToStr(j))).Text;
      

  2.   

    with TMemo1.Create(mParent) do 
    begin
      Parent := mParent;
      Left := Width * I;
      Top := Height * J;  
    end;   .....
      for I := 0 to M - 1 do
        for J := 0 to N - 1 do
         S := S + TEdit(FindComponent('Edit'+IntToStr(i)+'_'+IntToStr(j))).Text;//for J  S :Tstrings;
        S := S + #1013; //for I
      
    Memo1.Lines := S; 
      

  3.   

    上边的TMemo1->TMemoLeft/Top :自己改
    Width/Height自己写;
      

  4.   

    function f(mParent: TWinControl; M, N: Integer): Boolean;
    var
      I, J: Integer;
    begin
      Result := False;
      if not Assigned(mParent) then Exit;
      for I := 0 to M - 1 do
        for J := 0 to N - 1 do
          with TEdit.Create(mParent) do begin
            Parent := mParent;
            Name := Format('Edit%d_%d', [I, J]);
            Left := Width * I;
            Top := Height * J;
          end;
      Result := True;
    end;function GetEditText(mParent: TWinControl; mCol, mRow: Integer): string;
    begin
      Result := '';
      if not Assigned(mParent) or
        not (mParent.FindComponent(Format('Edit%d_%d', [mCol, mRow])) is TEdit) then
        Exit;
      Result := TEdit(mParent.FindComponent(Format('Edit%d_%d', [mCol, mRow]))).Text;
    end;function g(mParent: TWinControl; M, N: Integer): string;
    var
      I, J: Integer;
      S: string;
    begin
      Result := '';
      if not Assigned(mParent) then Exit;
      for J := 0 to M - 1 do begin
        S := '';
        for I := 0 to N - 1 do
          S := S + #9 + GetEditText(mParent, I, J);
        Delete(S, 1, 1);
        Result := Result + S + #13#10;
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
      vForm: TForm;
    begin
      vForm := TForm.Create(nil);
      try
        vForm.AutoSize := True;
        f(vForm, StrToIntDef(Edit1.Text, 0), StrToIntDef(Edit2.Text, 0));
        vForm.ShowModal;
        ShowMessage(g(vForm, StrToIntDef(Edit1.Text, 0), StrToIntDef(Edit2.Text, 0)));
      finally
        vForm.Free;
      end;
    end;
      

  5.   

    为什么不用我的方案呢?unit MyFormUnit;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TMyForm = class (TForm)
      protected
        FEdits:array of array of TEdit;
      public
        procedure EditExit(Sender: TObject);
        constructor CreateWithEdits(Owner:TComponent;M,N:Integer);
      end;
    var
      MyForm: TMyForm;implementation{$R *.DFM}constructor TMyForm.CreateWithEdits(Owner:TComponent;M,N:Integer);
    const
      EDITWIDTH = 100;
    var
      i,j:Integer;
    begin
      inherited Create(Owner);
    0A  SetLength(FEdits,M);
      for i := 0 to m-1 do
      begin
        SetLength(FEdits[i],N);
        for j := 0 to n-1 do
        begin
          FEdits[i,j] := TEdit.Create(self);
          FEdits[i,j].Width := EDITWIDTH;
          FEdits[i,j].Left := i * (EDITWIDTH + 10) + 10;
          FEdits[i,j].Top := j * (FEdits[i,j].Height + 5) +5;
          FEdits[i,j].OnExit := EditExit;
          InsertControl(FEdits[i,j]);
        end;
      end;
    end;procedure TMyForm.EditExit(Sender: TObject);
    begin
      with (Sender as TEdit) do
      begin
        //处理Edit的Exit事件.
      end;
    end;end....
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TMyForm.CreateWithEdits(self,10,15).Visible := true;
    end;访问FEdits[i,j]就可以啦!     ____     ____
         \ p \   / g /
          \ l \_/ n /
           \ a   o /
            \ i s /
             \ n /
              \_/