hurry up!...窗體數據交換問題? 把form1窗體的stringGrid的某cells[col,row]數據傳到form2後,怎樣把form2處理後的數據返回到form1的stringGrid的cells[col,row]? 請賜教!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 form1中写if form2.domodal()==mrokthenbegin ///cells[col,row]=form2...........end; 从form1传到form2时,记录传递的是form1的stringgrid中的哪个cell中的数据,在从form2向回传时,读出记录的cell不就可以了 function TForm2.HandleCell(var ACellStr: String);变参不就行了 //Unit 代码unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls, Buttons;type TForm1 = class(TForm) StringGrid1: TStringGrid; BitBtn1: TBitBtn; procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure StringGrid1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementationuses unit2;{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);var i:integer;begin StringGrid1 .RowCount :=12; for i:=1 to 11 do begin StringGrid1 .RowHeights [i]:=20; StringGrid1 .Cells [1,i]:=Inttostr(i); end;end;procedure TForm1.BitBtn1Click(Sender: TObject);var Form2:TForm2;begin Form2:= TForm2 .Create(Owner); Form2.Str :=StringGrid1 .Cells [StringGrid1 .Col,StringGrid1 .Row]; if form2.ShowModal =mrok then begin StringGrid1 .Cells [StringGrid1 .Col,StringGrid1 .Row]:=Form2 .Str ; end; form2.Free;end;procedure TForm1.StringGrid1DblClick(Sender: TObject);begin BitBtn1 .Click ;end;end. //Unit2代码unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm2 = class(TForm) Button1: TButton; Button2: TButton; Edit1: TEdit; private procedure SetStr(const Value: String); function GetStr: String; { Private declarations } public { Public declarations } published property Str:String Read GetStr Write SetStr; end;implementation{$R *.dfm}{ TForm2 }function TForm2.GetStr: String;begin Result:=Edit1.text;end;procedure TForm2.SetStr(const Value: String);begin edit1.text:=Value ;end;end. 散分,DELPHI人才 有关delphi中edit数值计算的问题!高手请指教!!! 如何得到用户在百度里面搜索的关键字? 关于listbox的滚动条问题 请问此段程序怎样实现? 急,字段权限问题! 小新,伴水大虾,快来帮我解决问题呀。。。 关于EXCEL的问题,比较有挑战性,高手请进! 答对的给一千分! 急用。 关于进程管理。 我在一个函数中设置返回值 为 TStrings,在调用该 函数时,该变量的COUNT 属性值为 0; 请问Delphi7.0的序列号以及authorized number是什么? 50分 请教Ehlib3.0的完整的安装,卸载方式。
if form2.domodal()==mrok
then
begin
///cells[col,row]=form2...........
end;
变参不就行了
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, Buttons;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure StringGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses unit2;
{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
begin
StringGrid1 .RowCount :=12;
for i:=1 to 11 do
begin
StringGrid1 .RowHeights [i]:=20;
StringGrid1 .Cells [1,i]:=Inttostr(i);
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
var
Form2:TForm2;
begin
Form2:= TForm2 .Create(Owner);
Form2.Str :=StringGrid1 .Cells [StringGrid1 .Col,StringGrid1 .Row];
if form2.ShowModal =mrok then
begin
StringGrid1 .Cells [StringGrid1 .Col,StringGrid1 .Row]:=Form2 .Str ; end; form2.Free;
end;procedure TForm1.StringGrid1DblClick(Sender: TObject);
begin
BitBtn1 .Click ;
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
private
procedure SetStr(const Value: String);
function GetStr: String;
{ Private declarations }
public
{ Public declarations }
published
property Str:String Read GetStr Write SetStr;
end;
implementation{$R *.dfm}{ TForm2 }function TForm2.GetStr: String;
begin
Result:=Edit1.text;end;procedure TForm2.SetStr(const Value: String);
begin
edit1.text:=Value ;end;end.