Mega Code Archive

 
Categories / Delphi / VCL
 

Change with enter to the next field in a dbgrid

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;