过程调用问题,帮我看看 (20分)

H

huayf

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm2.Checkboxcheck (var ch : string); //自定义过程
begin
with ADOQuery3 do begin
SQL.Text := Format('update answ set jilu=''true'' where name=%s and qst='''+ch+'''', //参数引用
[Quotedstr(DBCombobox1.Text)]);
showmessage(SQL.Text);
ExecSQL;
end;
end;

procedure TForm2.DBComboBox1Change(Sender: TObject);
var str :string;
begin
......
with Tcheckbox.Create(self) do begin
........
onclick:=checkboxcheck(str); //过程的调用
......
end;

提示出错: Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter'

 
显然有问题~~!
 
你checkboxcheck写法一定要和本身的onclick事件的定义一样!否则你肯定是错!
checkboxcheck()里的参数一定是个对象,这样你就必须将你动态创建的对象作为参数!传进去
最后再在checkboxcheck过程里面判断字符串!
 
参数怎么传,你能举个例吗?多谢
 
顶部