VAR
AdoCount01 AdoCount02: TADOQuery;
DsCount01: TDataSource;
The begin
AdoCount01:=TADOQuery. Create (Application);//create
AdoCount01. Connection:=ADOConnection1; The bound data source
DsCount01:=TDataSource. Create (Self);//create control
DsCount01. The DataSet:=AdoCount01;//bind
DBGrid01. The DataSource:=DsCount01;//binding form
end;
The problem is that after dynamically created controls, can be used by other events in?
I create the control in the button 1, for example, I want to use this when click on the button 2 controls,
CodePudding user response:
Look at Delphi variable scope,CodePudding user response:
AdoCount01, DsCount01 statement to button 1, 2 button in the form of a member of the can, but the button 2 case need to check the validity of reuse:If Assigned (AdoCount01) then...