开发者

Delphi: How to select row in a TDBGrid after deleting a record?

开发者 https://www.devze.com 2023-01-10 03:36 出处:网络
I\'m running a SQL query to delete the record, then trying the following: gridProjects.DataSource.DataSet.DisableControls;

I'm running a SQL query to delete the record, then trying the following:

gridProjects.DataSource.DataSet.DisableControls;
try
  gridProjects.DataSource.DataSet.Refresh;
finally
  gridProjects.DataSource.DataSet.EnableControls;
end;

The record disappears from the grid, but then the user cannot select another row in the grid, using the mouse or keyboard, and no row in the grid is highlighted. It acts as if it's lo开发者_开发知识库cked up.


Try moving the call to DisableControls to inside the try/finally block. If that "solves" the immediate issue, stop everything and go find out what is throwing an exception in DisableControls.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号