(Gast)
n/a Beiträge
|
Re: Daten anzeigen in StringGrid und TEdit
5. Jun 2007, 12:24
Delphi-Quellcode:
procedure TDemoForm.cmdItemAddExecute(Sender: TObject);
begin
with DatModul, ItemDlg do
begin
...
if ShowModal = mrOK then
begin
QueryAdr.Append;
QueryAdr.FieldByName('Name1').AsString := EdName1.Text;
...
QueryAdr.Post;
if QueryAdr.Locate('name1', EdName1.Text, []) then
StringGrid.Row := QueryAdr.RecNo;
end;
procedure TDemoForm.DataSetChanged(DataSet: TDataSet);
begin
if DataSet.Active
then StringGrid.RowCount := Max(Succ(DataSet.RecordCount), 2)
else StringGrid.RowCount := 2;
StringGrid.Invalidate;
end;
procedure TFDemoForm.DataSourceDemoDataChange(Sender: TObject; Field: TField);
begin
if not Assigned(Field) then
with Sender as TDataSource do
if DataSet.Tag = 0 then
DataSetChanged(DataSet);
end;
|
|
Zitat
|