How can I tell when a Delphi TDBGrid has finished populating from a database? -
i have database populating tdbgrid in delphi 2007 pro. when grid finishes populating, want automatically fill list box based on data processed grid. can manually watching , waiting grid fill dataset , calling next procedure. there event allow calling next procedure when grid finishes populating automatically? thanks.
if you're using tdataset
descendant, can use afteropen
event:
"afteropen called after dataset establishes access data , dataset put dsbrowse state."
edit (code sample comments duilio's answer): in below, 'cds' 'tclientdataset'. 'tdbgrid' attached data set means of 'tdatasource', grid's functionality not in way effected code below, or listbox's functionality grid's matter..
procedure tform1.cdsafteropen(dataset: tdataset); var sl: tstringlist; begin sl := tstringlist.create; try sl.sorted := true; sl.duplicates := dupignore; dataset.disablecontrols; try dataset.first; while not dataset.eof begin sl.add(dataset.fields[1].asstring); dataset.next; end; dataset.first; dataset.enablecontrols; end; listbox1.items.assign(sl); sl.free; end; end;
Comments
Post a Comment