现在有6个文本框,字符串S='123,456,78,a,b,c'
怎么把文本框1的值为123,文本框2的值为456,文本框3的值为78,……

解决方案 »

  1.   

    edit1.Text:=copy(s,0,3);
    edit2.Text:=copy(s,5,3);
    edit3.Text:=copy(s,9,2);
    .....
      

  2.   

    var
    s:string;
    ts:TStringList;
    i,j:integer;
    begin
    s:='123,456,78,a,b,c';
    ts:=TStringList.Create;
    while Pos(',',s)>0 do
    begin
      j:=POS(',',s);
      ts.Add(Copy(s,1,j-1));
      Delete(s,1,j);
    end;
    ts.Add(s);
    for i:=0 to ts.Count-1 do
    TEdit(self.FindComponent('Edit'+IntToStr(i+1))).Text:=ts[i];
    ts.Free;