Use the Length() function.
Use this instead:
for var i := 0 to Length(Instances)-1 do
Memo1.Lines.Add(Instances[i]);
Alternatively, you can use the Low()/High() functions to get the first and last indexes of the array:
for var i := Low(Instances) to High(Instances) do
Memo1.Lines.Add(Instances[i]);
Alternatively, you can use a for..in loop instead, no indexes needed:
for var elem in Instances do
Memo1.Lines.Add(elem);
However, in your particular example, the TMemo.Lines property has an overloaded method that accepts a TArray<string> as input, so you don't even need a loop at all:
Memo1.Lines.AddStrings(Instances);
You don't need that. Dynamic arrays know their own length.