rDBGrid find column by field name

39 views
Skip to first unread message

Matt

unread,
Feb 1, 2021, 11:37:32 AM2/1/21
to Rosi Delphi Components
Hi,

is there a simple function to get the column using the field name something like ColumnByName('ID') or do I have to loop through all columns and compare the fieldNames?

Thanks,
Matt

Tomas Rosinsky

unread,
Feb 1, 2021, 12:14:39 PM2/1/21
to Rosi Delphi Components
Hi,

rDBGrid provides public procedure GetFieldNameColumnIndex which provides exactly what you need.

    { return column index for specific field name }
    function GetFieldNameColumnIndex(const FieldName: string): integer;

Regards
Tomas

Matt

unread,
Feb 2, 2021, 3:25:07 AM2/2/21
to Rosi Delphi Components
Thanks, that's it
Reply all
Reply to author
Forward
0 new messages