把dbgrid的options的dgindicator设为false, procedure TForm1.DBGrid1CellClick(Column: TColumn); begin showmessage(inttostr(form1.Table1.RecNo));//判断选择了哪一条记录 end;
DBGrid.DataSource.Dataset.GotoBook(Pointer(DBGrid.SelectedRows.Items[0])); for j := 0 to DBGrid.SelectedRows.Count - 1 do begin . . . DBGrid.DataSource.Dataset.GotoBook(Pointer(DBGrid.SelectedRows.Items[J+1])); end
假如我有一個表當中有10條記錄,客戶要選擇9條記錄放入另一個表, 而這10條記都顯示在DBGRID1當中, 我的思路是 table1.first; while not eof do --不知對不對。 begin if (是被選中的) then begin table2.append ...... end; end;
只要用戶選擇了就算,
procedure TForm1.LeftRightClick(Sender: TObject);
begin
DBGrid1.SelectedIndex := DBGrid1.SelectedIndex + TComponent(Sender).Tag;
DBGrid1.SetFocus;
end;
procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
showmessage(inttostr(form1.Table1.RecNo));//判断选择了哪一条记录
end;
for j := 0 to DBGrid.SelectedRows.Count - 1 do
begin
.
.
.
DBGrid.DataSource.Dataset.GotoBook(Pointer(DBGrid.SelectedRows.Items[J+1]));
end
而這10條記都顯示在DBGRID1當中,
我的思路是
table1.first;
while not eof do --不知對不對。
begin
if (是被選中的) then
begin
table2.append
......
end;
end;