How to refresh dbgrid without close and open dataset in delphi?

Daniel Grillo picture Daniel Grillo · Feb 22, 2010 · Viewed 11.9k times · Source

I need to refresh dbgrid constantly, in real time. Close and open dataset works fine, but blink the dbgrid. What can I do to avoid this?

I'd like a solution like Ajax, that update only the necessary.

Thanks

Answer

Lieven Keersmaekers picture Lieven Keersmaekers · Feb 22, 2010

Have you tried to use Disable- & EnableControls?

DataSet.DisableControls;
try
  DataSet.Close;
  DataSet.Open;
finally
  DataSet.EnableControls;
end;

Furthermore, it should be possible to just call DataSet.Refresh instead of closing and opening to get the same result.