Re: Populating a combo from a database table faster



<tglunz@xxxxxxxxxxxxxxxxxxxxx> wrote:

I was wondering if anyone know a faster way to populate a combo?

This is the first thing you should do:

Combo.items.BeginUpdate;
try
Combo.items.clear;
CodeQuery.First; // ADO dataset
while not CodeQuery.Eof do begin
Combo.Items.Add(CodeQuery.Fields[0].AsString);
CodeQuery.Next;
end;
finally
Combo.items.EndUpdate;
end;

This should speed things up significantly.

If that isn't enough, you could try virtual-data approach,
but I doubt if it will help much since you're going to be
accessing an ADO Dataset which is not (by design) fast for
incremental access.
.