fraxzi Posted August 11, 2022 Share Posted August 11, 2022 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 11, 2022 Share Posted August 11, 2022 Hello, 3 hours ago, fraxzi said: On my datamodule, i have this afterpost on my query ? Quote Link to comment Share on other sites More sharing options...
fraxzi Posted August 11, 2022 Author Share Posted August 11, 2022 7 minutes ago, Sherzod said: Hello, ? from the above procedure, I called: error is "Owner Form not found." Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 11, 2022 Share Posted August 11, 2022 Is there more code above? If grid is related with this DataSet, then it should automatically update... Quote Link to comment Share on other sites More sharing options...
fraxzi Posted August 12, 2022 Author Share Posted August 12, 2022 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 12, 2022 Share Posted August 12, 2022 Hello, And if you refresh the grid on the form itself, does it show the updated data? Quote Link to comment Share on other sites More sharing options...
zilav Posted August 12, 2022 Share Posted August 12, 2022 grdXXX.RefreshCurrentRow ? Quote Link to comment Share on other sites More sharing options...
zhyhero Posted August 12, 2022 Share Posted August 12, 2022 You can try Event EventNotify.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.