开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜