我再写一边
unit No;
interface
uses
Windows, Messages, SysUtils, Classes, Dialogs;
type
TEvent= procedure(sender of Tobject) of object
TNo = class(TComponent)
private
FNO: Integer;
FNoIS: String;
FEvent: TEvent;
procedure SetNOis(const Value: String);
procedure setFno(const Value: Integer);
procedure SetEvent;(conset Value: TEvent);
protected
{ Protected declarations }
public
Constructor Create(AOwner: TComponent); Override;
published
property NO: Integer Read Fno Write setFno;
Property ONNOIs: String Read FNOis Write SetNOis;
property OnEvent : TEvent read FEvent write SetEvent;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('HSTDB', [TNo]);
end;
{ TNo }
constructor TNo.Create(AOwner: TComponent);
begin
inherited;
if csDesigning in ComponentState Then
begin
Fno:= 0;
FNois:= 'aa';
End else
if (Fnois='123456') and (fno=123) then
if assigned(FEvent) then FEvent(self);
end;
procedure TNo.setFno(const Value: Integer);
begin
Fno := Value;
end;
procedure TNo.SetNOis(const Value: String);
begin
FNois:= Value;
end;
procedure SetEvent;(conset Value: TEvent);
BEgin
FEvent:= Value;
End;
end.
楼上众多人都说出了毛病 我也知道了 就是不能放在Create事件内
我想问一下 不放的Create事件内放的什么地方 可出作出
让这段代码运行 if assigned(FEvent) then FEvent(self);