tdbf1 lazarus / 21-General ---------------------------------------------------------------------- crownfield · 2022-06-18 02:22 new to lazarus. trying to get dbf fieldnames as strings, and then add them to radiobuttons as items. they seem to be locked properties. the editor knows them, lets me enter them, and the compiler produces errors. is there any way around this? did not get these errors in delphi. ---------------------------------------------------------------------- dsiders · 2022-06-18 02:48 Quote from: crownfield on June 18, 2022, 04:22:42 amnew to lazarus. trying to get dbf fieldnames as strings, and then add them to radiobuttons as items. they seem to be locked properties. the editor knows them, lets me enter them, and the compiler produces errors. is there any way around this? did not get these errors in delphi. TDbf.FieldDefs has the TFieldDef entries defined for the database file: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ADbf.FieldD efs.Items[n].NameADbf.FieldDefs.Items[n].DataTypeADbf.FieldDefs.Items[ n].SizeADbf.FieldDefs.Items[n].Precision... Sames as TDataset in Delphi. Not sure what you mean about locked... unless you tried to change a read-only property. [EDIT] There is also TDbf.GetFieldNames to store all of the names in a TStrings instance. ---------------------------------------------------------------------- rvk · 2022-06-18 04:08 Quote from: crownfield on June 18, 2022, 04:22:42 amnew to lazarus. ... and the compiler produces errors. is there any way around this? did not get these errors in delphi. Tip: ALWAYS mention the (exact) error(s) you get in your questions. And also what version of FPC and Lazarus you are using. And what code you are using. ---------------------------------------------------------------------- dje · 2022-06-19 01:26 First you need a function to copy FieldNames from TFields to TStrings. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure StringsLoadFrom(AStrings: TStrings; AFields: TFields);var  LIndex: integer;begin  AStrings.Clear;  for LIndex := 0 to AFields.Count - 1 do begin    AStrings.Add(AFields[LIndex].FieldName);  end;end; Then set TableName, Open and use the function to copy FieldNames to a TRadioGroup. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Dbf1.TableName := 'contacts.dbf';  Dbf1.Open;  StringsLoadFrom(RadioGroup1.Items, Dbf1.Fields); EDIT: As dsiders said, GetFieldNames works too Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Dbf1.GetFieldNames(RadioGroup1.Items); ---------------------------------------------------------------------- howardpc · 2022-06-19 03:32 @derek.john.evans Great to see you active again on this forum. Long may you continue with us.