for t := 0 to ComponentCount-1 do begin s := Components[t].Name; st := Copy(s,Length(s)-4,Length(s)); if (st='Graph') then begin fn := Copy(s,1,Length(s)-5)+'.bmp'; try TChart(Components[r]).SaveToBitmapFile(fn); finally
end; end; end;
Essentially what the code does is loop through all components in the current scope and if a component name ends in Graph the idea is to save it as a Bitmap file. all goes well until I execute the savetobitmapfile method when I get an access violation
Have you stepped through with the debugger?
Where do you setup 'r'?
Your loop variable is "t", but in accessing the chart you use "r".
I must be going blind, thank you