Главная страница | назад





Article #17170: Getting values in a TDBGrid before they are posted

 Question and Answer Database

FAQ2170D.txt   Getting values in a TDBGrid before they are posted
Category   :Database/VCL
Platform    :All
Product    :All 32 bit  

Question:
How do I know what is being typed into the grid? 

Answer:
You can see what is being typed into a TDBGrid by looking at 
the TInPlaceEdit control of the TDBGrid. Care should be taken 
to make sure that the TInPlaceEdit control is created before 
trying to use it. The following function will show the data in 
the column of the grid that is being edited: 

procedure TForm1.DBGrid1KeyUp(Sender: TObject; 
     var Key: Word; Shift: TShiftState);
var
  B: byte;

begin
  for B := 0 to DBGrid1.ControlCount - 1 do
  if DBGrid1.Controls[B] is TInPlaceEdit then
  begin
    with DBGrid1.Controls[B] as TInPlaceEdit do
    begin
      Label1.Caption := 'Text = ' + Text;
    end;
  end;
end;

Please reference TInPlaceEdit in the Delphi 3 help file for 
more information on it's functionality. 

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99