I have this DB_Grid that shows some values.See the attached small example.
See Screen 1.
When I am deleting an entry it shows all the columns in that grid.
See Screen 2
How to avoid/correct this?Why shoudn't you expect AddAutomaticColumns to be performed on runtime on your case?
As exposed it sounds like a bug, columns with width=0 should be respected on record deletion, but there had been some changes there and bugs may have been introduced.The problem only happens on setting all properties by code (see old attached example).
Instead of width=0 have your tried to set the visible property to false?
This is a different problem.Madref didn't show a sample, but I believe he is setting the properties at runtime... and there isn't any properties stored anywhere...
By setting the properties at runtime, it's the same as if some user had interactively changed the properties, those properties are not stored anywhere so, if you close and reopen the query you must redo, recreate or replay the actions that changed the grid properties, in your sample you have to copy the third section of your formshow procedure into a new procedure 'UpdateGrid' for example and call it, then after reopened the dataset call 'UpdateGrid' again. I have not checked your second sample but if the properties are stored at design time, then when you reopen the dataset, the grid already have the changed properties (with respect to a unmodified at design time grid) so it should work OK.
The problem madref reported, as I understood it, is that if you delete one record, then some columns that had 0 width (and as a consequence remained hidden), will suddenly become visible because their widths are no 0 anymore.