L
loner_meme
Unregistered / Unconfirmed
GUEST, unregistred user!
我想用多线程增加Combobox中的项目,请教高手一下,下面的程序代码有没有错误(有的话,应该怎么做):
Constructor AddItemThread.Create(Q : TQuery;
CMBStrings : TStrings;
S : String);
begin
Query := Q;
SFieldName := S;
CMBAdd := CMBStrings;
Inherited Create(false);
FreeOnTerminate := True;
end;
Procedure AddItemThread.Execute;
begin
With CMBAdddo
begin
Clear;
Add('- 全部 -');
With Querydo
begin
Close;
Open;
First;
While Not Eofdo
begin
Add(FieldByName(SFieldName).AsString);
Next;
end;
end;
end;
end;
Constructor AddItemThread.Create(Q : TQuery;
CMBStrings : TStrings;
S : String);
begin
Query := Q;
SFieldName := S;
CMBAdd := CMBStrings;
Inherited Create(false);
FreeOnTerminate := True;
end;
Procedure AddItemThread.Execute;
begin
With CMBAdddo
begin
Clear;
Add('- 全部 -');
With Querydo
begin
Close;
Open;
First;
While Not Eofdo
begin
Add(FieldByName(SFieldName).AsString);
Next;
end;
end;
end;
end;