I'm trying to read from a file and populate a stringgrid, and keep getting 'Project spares.exe raised an exception class 'External error: SIGSEGV' when trying to convert an integer to string. Running the application gets the dialog: Access Violation Press OK to ignore and risk data corruption or cancel to kill the program. Clicking OK brings the grid up with the header row populated, and the first field in the first non-fixed row (Cells[0,1]) with the proper value, but the rest of the table is blank. I put a try...finally block in and now the IDE breaks at the read statement. Any suggestions? The code snippet follows.

procedure TfrmDashBoard.GetInvExecute(Sender: TObject;
                                       DB : string);
var
  {stockItem type is a record with the following structure:
    recordID    : longint;
    ClassNumber : integer;
    PartNumber  : string;
    Make        : String;
    TypeofEqip  : string;
    Model       : string;
    Description : string;
    quantity    : integer;
    location    : string;
    price       : real;    }

   workspace : Stockitem;
   row       : longint;

begin
     assignfile(inventory,db);
     try
     reset(inventory);
     row := 0;
     while not eof(inventory) do
           begin
               read(inventory,workspace);
               inc(row);
               if db = 'Ops' then
                 with stgInvOps do
                      begin
Cells[0,row] := inttostr(workspace.ClassNumber);
                           Cells[1,row] := workspace.PartNumber;
                           Cells[2,row] := workspace.Make;
                           Cells[3,row] := workspace.TypeofEqip;
                           Cells[4,row] := workspace.Model;
                           Cells[5,row] := workspace.Description;
Cells[6,row] := inttostr(workspace.quantity);
                           Cells[7,row] := workspace.location;
                           Cells[8,row] := floattostr(workspace.price);
                      end
               else

thanks.
windows7 32bit, SP1
Lazarus 0.90.30
FPC: 2.4.2
-Chris

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to