Q&A

  • DBGrid의 다중선택시
DBGrid에서 다중선택이 되어 있을 경우,
1  COMMENTS
  • Profile
    윤종경 2002.11.09 02:33
    procedure TForm1.BitBtn1Click(Sender: TObject);
    var
      i, j: Integer;
      s: string;
    begin
      if DBGrid1.SelectedRows.Count >0 then
      begin
        with DBGrid1.DataSource.DataSet do
        begin
          for i:=0 to DBGrid1.SelectedRows.Count-1 do
          begin
            GotoBookmark(pointer(DBGrid1.SelectedRows.Items[i]));
            for j := 0 to FieldCount-1 do
            begin
              if (j > 0) then s := s + ', ';
              s := s + Fields[j].AsString;
            end;
            Listbox1.Items.Add(s);
            s:= '';
          end;
        end;
      end;
    end;