循环问题出在哪里呢。请教高手
for i:=1 to 9 do
begin
s:=pchar(label3.Caption);
if opencom(1,9600)=1 then
begin
if (senddata(s,length(label3.Caption))=0) then
begin
Memo1.Text:=label3.Caption+' '+'写卡失败';
APPLICATION.ProcessMessages;
sleep(1500);
closecom();
end ;
if (senddata(s,length(label3.Caption))=1) then
begin
Memo1.Text:=label3.Caption+' '+'写卡成功';
label3.caption:=inttostr(strtoint(label3.caption)+1);
APPLICATION.ProcessMessages;
sleep(1500);
closecom();
end;
end;
end;
在第一次循环中第3个if(senddata(s,length(label3.Caption))=1) 里的条件要满足2次,里面的语句才能执行。问题出在哪里呢???