J
jbas
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在listbox中添加两个数据进一个item,但不能有相同的data(addobject中的object),这
段代码有什没错误呢?谢谢!
procedure TFrmDphb.Button4Click(Sender: TObject);
var
I:integer;
TempBl:boolean;
TempStr:string;
TempPstr:string;
begin
TempBl:=true;
TempPstr:=FramDpInfo1.EdtDpbh.Text;
TempStr:=FramDpInfo1.EdtDpName.Text;
for I:=0 to hbDpList.Items.Count-1 do
begin
if string(hbDpList.Items.Objects)=TempPstr then
// if hbDpList.Items=TempStr then
TempBl:=false;
end;
if TempBl=true then
hbDpList.Items.AddObject(TempStr,tobject(TempPstr));
// hbDpList.Items.Add(FramDpInfo1.EdtDpName.Text);
end;
段代码有什没错误呢?谢谢!
procedure TFrmDphb.Button4Click(Sender: TObject);
var
I:integer;
TempBl:boolean;
TempStr:string;
TempPstr:string;
begin
TempBl:=true;
TempPstr:=FramDpInfo1.EdtDpbh.Text;
TempStr:=FramDpInfo1.EdtDpName.Text;
for I:=0 to hbDpList.Items.Count-1 do
begin
if string(hbDpList.Items.Objects)=TempPstr then
// if hbDpList.Items=TempStr then
TempBl:=false;
end;
if TempBl=true then
hbDpList.Items.AddObject(TempStr,tobject(TempPstr));
// hbDpList.Items.Add(FramDpInfo1.EdtDpName.Text);
end;