RAD Studio VCL Reference
|
Returns a field given its field name.
function FieldByName(const FieldName: string): TField;
__fastcall TField FieldByName(const AnsiString FieldName);
Call FieldByName to retrieve field information for a field when only the field's name is known. FieldName is the name of an existing field. FieldByName returns the TField component for the specified field. If the field can not be found, an exception is raised.
When the Fields array contains ADT fields, you can use FieldByName to access the subfields of those ADT fields. To access subfields, specify FieldName as the name of the subfield qualified by the name of the ADT field, as in the following:
CityEdit.Text := Customer.FieldByName('Address.City').AsString;
CityEdit->Text = Customer->FieldByName("Address.City")->AsString;
FieldByName is especially useful when you do not have access to the underlying table and cannot use persistent field components.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|