Jump to content

refresh a dbgrid from datamodule (afterpost) from another form (unit)


fraxzi

Recommended Posts

Quote

 

Hi Everyone,

On my datamodule, i have this afterpost on my query.. once the data posted, i'd like to refresh a dbgrid from another form/frame (unit).

If I call TFromAnotherForm.dbgrid.refresh got this error "Owner Form not found."

How to solve this?

 

Thanks in advance.

Link to comment
Share on other sites

procedure TdmMonitoring01.sqlMonitoringAfterPost(DataSet: TDataSet);
begin
  with sqlMonitoring do
  begin
    Connection.StartTransaction;
    try
      ApplyUpdates; 
      Connection.Commit;
    except
      RestoreUpdates;
      Connection.Rollback;
      MainForm.ShowToast('SAVING FAILED!');
      raise;
    end;
    CommitUpdates;
    Refresh;        // dgGrid not refresh!??? Why?
    MainForm.ShowToast('DATA SAVED!');
  end;
end;

I added "Refresh" to the Query but dgGrid still not refreshed.. The data displayed was not changed. I also confirmed the data was saved..

If I call lik form1.dbgrid.refresh from form2 I get the error "Owner Form not found". So what should be the right approach?

 

Thanks,

Frances

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...