Design-time created FieldDefs for dbf table lazarus / 16-Databases ---------------------------------------------------------------------- wp · 2016-07-22 21:28 Playing with a dbf datastore for TvPlanit I came across this issue: All the examples for creation of dbf files show how FieldDefs are created at run-time code. See for example http://wiki.freepascal.org/L azarus_Tdbf_Tutorial#Code_example:_creating_a_table.2FDBF_file. But TDbf is a component in the Lazarus component palette and has a property FieldDefs with property editor in the Object Inspector. Therefore, it should be possible to add the fielddefs at designtime. However, when the program is run and the table is opened after creation then an error "Invalid dbf file: Invalid field definition" is reported. Please see attached demo. Button "FieldDefs by code" follows the wiki example and creates the fields at runtime - no issues here. But button "FieldDefs from OI" creates the FieldDefs at design time in the Object Inspector and crashes as described. Am I missing something? ---------------------------------------------------------------------- wp · 2016-07-23 19:56 Found it... According to documentation, TDbf has a property StoreDefs which must be set to true if FieldDefs are supposed to be stored in the lfm file. In this case, the table is created correctly without any error. I added a note to the wiki article (http://wiki.freepascal.org/Lazarus _Tdbf_Tutorial#Adding_fields_at_designtime).