<div dir="ltr"><div>Hi there,<br><br>I would like to use TVarRec as Variants, after some googling I found this:<br><br><a href="http://stackoverflow.com/questions/3733640/how-to-convert-between-tvarrec-and-variant">http://stackoverflow.com/questions/3733640/how-to-convert-between-tvarrec-and-variant</a><br>
<br></div>However, it generated Runtime error 217. My original code (runs OK) is:<br><div><div><br><span style="font-family:courier new,monospace"> 1 program test;<br> 2 {$mode objfpc}{$H+}<br> 3 procedure vart(par: array of const);<br>
4 var<br> 5 i: Integer;<br> 6 begin<br> 7 i := par[0].VInteger;<br> 8 WriteLn('first param=', i);<br> 9 end;<br> 10 begin<br> 11 vart([1, 2, 3]);<br> 12 end.</span><br><br></div><div>Modified code (runtime error 217) is:<br>
<br><span style="font-family:courier new,monospace"> 1 program test;<br> 2 {$mode objfpc}{$H+}<br> 3 procedure vart(par: array of Variant);<br> 4 var<br> 5 i: Integer;<br> 6 begin<br> 7 i := par[0];<br> 8 WriteLn('first param=', i);<br>
9 end;<br> 10 begin<br> 11 vart([1, 2, 3]);<br> 12 end.</span><br><br></div><div>Any ideas? Thanks!<br></div><div><br></div><div><br></div></div></div>