/*
MoveBy, SelectedIndex, Tag example
The following example enables the user to move the current selected cell in a db grid.  The Up and Down buttons have their OnClick events assigned to the UpDownClick procedure.  The Left and Right buttons have their OnClick events assigned to the LeftRightClick procedure.  The Up and Left buttons have their Tag property set to –1, while the Down and Right buttons have their Tag property set to 1.
*/ 
void __fastcall TForm1::UpDownClick(TObject *Sender)
{
  ClientDataSet1->MoveBy(((TComponent *)Sender)->Tag);
  DBGrid1->SetFocus();
}

void __fastcall TForm1::LeftRightClick(TObject *Sender)
{
  DBGrid1->SelectedIndex = DBGrid1->SelectedIndex + ((TComponent *)Sender)->Tag;
  DBGrid1->SetFocus();
} 
