How to get data from field in DBGrid ? lazarus / 9-Editor ---------------------------------------------------------------------- Kikus · 2009-09-28 07:06 Hello, I have a dbf file loaded into the DBGrid component. I need to read data from field determined by X/Y coordinates for calculations. Can Anybody write how to do that ? regards ---------------------------------------------------------------------- jesusr · 2009-09-28 18:12 In reality you can only access fields on current record (the one signaled with > indicator) using the linked dataset, not through dbgrid. if you need to access fields on current record, do it using dataset, for example: Code: [Select]  total := dbf1.fieldbyname('price').asFloat * dbf1.fieldbyname('ctd').asFloat; To move current record programatically you need to use dataset methods first, next, previous, last, EOF, for example, if you need to do some calcs based on all records of table, you will need to do something like: Code: [Select]dbf1.disablecontrols; // this avoids dbgrid or other dbcontrols reacting                       // while current record is being moved Total := 0.0; dbf1.first; while not dbf1.eof do begin   // do something with current record, ex a running total   total := total + dbf1.fieldbyname('price').asFloat * dbf1.fieldbyname('ctd').asFloat;   dbf1.next; end; dbf1.first; // this sets the first record as the current record dbf1.enablecontrols; // ---------------------------------------------------------------------- cpalx · 2009-09-29 15:45 just adding before post. when you select a row in the dbgrid, you move the current record in that position, so you can get access to that information with your query.fieldbyname('filadname').asstring ---------------------------------------------------------------------- Kikus · 2009-09-30 16:56 Thanks @jesusr and @cpalx this is what I was looking for.