...change with enter to the next field in a DBGrid?

Author: Daniel Mariscal

Category: VCL

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  if 
Key = #13 then
  begin
    if 
DBGrid1.Columns.Grid.SelectedIndex < DBGrid1.Columns.Count - 1 then
      
DBGrid1.Columns[DBGrid1.Columns.grid.SelectedIndex + 1].Field.FocusControl
    else
    begin
      
Table1.Next;
      DBGrid1.Columns[0].field.FocusControl;
    end;
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base