如何用程序控制StringGrid的行移动,如第三行移动到第九行(我不太喜欢用数据库)

解决方案 »

  1.   

    我只会读第九行的
    for i:=1 to stringgrid1.ColCount-1 do
      str[i]:=stringgrid1.Cells[i,9];
      

  2.   

    只要将stringgrid的options下的gorowmoving设置为true,你就能在程序中手工拖动行了。
      

  3.   

    是指将指针移动到第九行form1.StringGrid1.Row:=3;
      form1.StringGrid1.SetFocus;还是指第三行的数据也一起移动到第九行?procedure TForm1.Button1Click(Sender: TObject);
    var
      list:TStringList;
      i,j:integer;
    begin
      list:=TStringList.Create;
      list.Clear;
      i:=form1.StringGrid1.ColCount;
      for j:=0 to i-1 do
      begin
        list.Add(form1.StringGrid1.Cells[j,8]);//记录第九行的数据
      end;
      for j:=0 to i-1 do
      begin
        form1.StringGrid1.Cells[j,8]:=form1.StringGrid1.Cells[j,2];
        form1.StringGrid1.Cells[j,2]:=list.Strings[j];
      end;end;
      

  4.   

    我在StringGrid中发现有move这个函数,可是不能用,包括rows.clear、rows.insert、rows.delete都不能用。不知道为什么,好像在c++builder中也这样。