I often refer to the values in a field in a dbgrid with the index number, for example:
dbgrid1.Fields[8].AsString:= 'SomeValue'; //index 8 refering to a field named 'Payment'
This works OK until I change the fields about that the dbgrid has listed in the field editor, at which time I have to search for all the above usage and change the index number.
It would be far simpler, and less opportunity for problems, if I could refer to the field with something like:
dbgrid1.Field('Payment').AsString:= 'SomeValue';
Is there a way of doing this?