The problem can be simplified to this code:
program Project1;
uses Classes;
var
L: TStringList;
sn, sv: String;
begin
L := TStringList.Create;
try
L.AddPair('Name1', 'Value1');
sn := L.Names[0];
sv := L.Values[0];
finally
L.Free;
end;
end.
Attempting to compile this results in the same error message: "Got shortint, expected AnsiString". But when you look carefully at the editor, you see that the cursor has been put after the 0 - this means that the problem is not in the result of L.Values[...], but in the index. Now look at the declaration of the Values property:
property Values[const Name: string]: string read GetValue write SetValue;
And in fact, the argument must be a string, not an integer like in your code.
So, when I change the code to
the compiler is happy.
If you want to use the index in the Values call, you should use the property ValueFromIndex[Index: Integer].