主题:求助-----字段分割问题
哪位大哥帮我看下:下面代码没有问题,但用其中注释的代码就不行,这是为什么啊???我在线等,哪位大哥救下我啊。谢谢了~!
edit1.Text:=query1.fieldbyname('bc').AsString;
j:=length(edit1.Text);
for i:=0 to j-1 do
begin
edit1.SelStart:=i;
edit1.SelLength:=1;
if edit1.SelText='*' then
begin
edit1.SelStart:=0;
edit1.SelLength:=i-5;
label1.Caption:=edit1.SelText;
//table1.FieldByName('gbhd').AsFloat:=strtofloat(edit1.SelText);
edit1.SelStart:=i-4;
edit1.SelLength:=4;
label2.Caption:=edit1.SelText;
//table1.FieldByName('gbkd').AsInteger:=strtoint(edit1.SelText);
edit1.SelStart:=i+1;
edit1.SelLength:=j-i+1;
label3.Caption:=edit1.SelText;
//table1.FieldByName('gbcd').AsInteger:=strtoint(edit1.SelText);
end;
end;
edit1.Text:=query1.fieldbyname('bc').AsString;
j:=length(edit1.Text);
for i:=0 to j-1 do
begin
edit1.SelStart:=i;
edit1.SelLength:=1;
if edit1.SelText='*' then
begin
edit1.SelStart:=0;
edit1.SelLength:=i-5;
label1.Caption:=edit1.SelText;
//table1.FieldByName('gbhd').AsFloat:=strtofloat(edit1.SelText);
edit1.SelStart:=i-4;
edit1.SelLength:=4;
label2.Caption:=edit1.SelText;
//table1.FieldByName('gbkd').AsInteger:=strtoint(edit1.SelText);
edit1.SelStart:=i+1;
edit1.SelLength:=j-i+1;
label3.Caption:=edit1.SelText;
//table1.FieldByName('gbcd').AsInteger:=strtoint(edit1.SelText);
end;
end;