change dbgrid options at runtime

dbgrid, delphi, delphi-xe2

Solution

When working with set types, this is how you do :

DBGrid.Options := DBGrid.Options + [dgEditing];  // Adds dbEditing option

DBGrid.Options := DBGrid.Options - [dgEditing];  // Removes dbEditing option

To change several options at once :

DBGrid.Options := DBGrid.Options + [dgEditing,dgRowSelect]; 
DBGrid.Options := DBGrid.Options + [dgEditing] + [dgRowSelect]; // Same as above

Problem

I want to change the DBGrid.Option.I found the following code: ``` DBGrid.Options:=DBGrid.Options + [dgEditing]; DBGrid.Options:=[dgEditing]; ``` But do not work properly and the error [dgEditing]. I want to enable or disable the [dgEditing],[dgRowSelect] mode. thanks a lot, a lot.

Original source