Use your favourite search engine and type "lazarus strtofloat", and you'll get
https://www.freepascal.org/docs-html/rtl/sysutils/strtofloat.html.
Or put the cursor on "StrToFloat" in your source code and press F1 to open the help file.
Or just move the mouse over "StrToFloat" in your source code, wait a short time and a popup will appear to show you the syntax.
So, plenty of possibilities...
You're code will not work, however, even with the correct syntax for StrToFloat. There are several issues:
- The rows in a StringGrid are numbered beginning with zero. The top-most row (having index 0), however, usually as the column title - which is not a number. Therefore, your i loop probably must skip the title and start with 1.
- The end of your i-loop is StringGrid.RowCount - this is too much. Because when the first index is 0 then the last index must be RowCount-1
- Your data array "Values" is dimensioned to hold 12 elements. What if there are more rows than that? What, if less?
The following code should work (untested, though)
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
Values: array[1..12] of double;
begin
for i := 1 to 12 do
if i < strGrid.RowCount then
Values[i] := StrToFloat(StrGrid.Cells[2, i])
else
Values[i] := 0; // Replacement value when grid has less rows than checked out.
end;