Board index » delphi » How can you prevent DBGrid from adding a record?

How can you prevent DBGrid from adding a record?

I am using the DBGrid component to display a selection of records for the
user to edit the field contents BUT if the user tabs past the end of the
list then the DBGrid creates another line. I can't find a way to block this.
Any ideas?

 

Re:How can you prevent DBGrid from adding a record?


On Thu, 30 Oct 1997 23:33:10 -0500, "Doug Malcolm"

Quote
<malc...@sympatico.ca> wrote:
>I am using the DBGrid component to display a selection of records for the
>user to edit the field contents BUT if the user tabs past the end of the
>list then the DBGrid creates another line. I can't find a way to block this.
>Any ideas?

It sounds like that you don't want to allow insertions to the assigned
table. If this is the case, in the BeforePost event handler Abort the
operation.
-------------------------------
Paul Lambadaris
mailto : p...@singular.gr
www    : http://www.singular.gr

Re:How can you prevent DBGrid from adding a record?


Call Abort in the BeforeInsert event handler of the underlying
dataset.

Bill

(Sorry but TeamB cannot answer support questions received via email.              )
(To send me email for any other reason remove .nospam from my address.)

Other Threads