I’m using this code to create a set of fields in runtime
ClientDataSet1.FieldDefs.Add('ID', ftInteger, 0);
ClientDataSet1.FieldDefs.Add('Serial', ftInteger, 0);
ClientDataSet1.FieldDefs.Add('Customer', ftString, 40);
ClientDataSet1.FieldDefs.Add('Address', ftString, 40);
ClientDataSet1.CreateDataSet;
Now I want to make some fields mandatory, how i can define a field created in runtime as mandatory?
The add method has a fourth parameter called required
set that value to True and your field will be mandatory.
example to make mandatory the field
IDuse this code