Z
zpselect
Unregistered / Unconfirmed
GUEST, unregistred user!
我求一函数,根据输入参数返回一个变量
function ReturnValue(sender: TWinControl): Variant;
begin
if sender.Controls[0] is TEdit then
begin
if TEdit(Sender.Controls[0]).Text = '' then
Result :=null
else Result := TEdit(Sender.Controls[0]).Text;
end else if sender.controls[0] is CheckBox then
begin
if TCheckBox(sender.Controls[0].checked=true then
Result:='1' else Result:='0';
end;
调用这一些方法:
procedure TMainfrm.Buttton1Click(Sender: TObject);
begin
Edit2.text:=ReturnValue(Edit1);
end;
调用时报地址错误!望高手改之!
function ReturnValue(sender: TWinControl): Variant;
begin
if sender.Controls[0] is TEdit then
begin
if TEdit(Sender.Controls[0]).Text = '' then
Result :=null
else Result := TEdit(Sender.Controls[0]).Text;
end else if sender.controls[0] is CheckBox then
begin
if TCheckBox(sender.Controls[0].checked=true then
Result:='1' else Result:='0';
end;
调用这一些方法:
procedure TMainfrm.Buttton1Click(Sender: TObject);
begin
Edit2.text:=ReturnValue(Edit1);
end;
调用时报地址错误!望高手改之!