其他分享
首页 > 其他分享> > Delphi OleVariant 取值/赋值操作

Delphi OleVariant 取值/赋值操作

作者:互联网

Delphi OleVariant 取值/赋值操作

procedure GetEData(sdata:OleVariant);  //取值
var
  sdata: OleVariant;
  High, Low, i: Integer;
  sList: TStringList;
begin
  sList:=TStringList.Create;
  try
    High := VarArrayHighBound(sdata, 1);
    Low := varArrayLowBound(sdata, 1);
    for i := Low to High do
    begin
      sList.Add(inttostr(sdata[i]))
    end;
  finally
    sList.Free;
  end;
end;

procedure SetEData(sdata:OleVariant);  //赋值
var
  i: Integer;
begin
  sdata := VarArrayCreate([0, 1000], varInteger);
  for i := 0 to 1000 do
    sdata[i] := i;
end;

 

 

创建时间:2021.02.03  更新时间:  

 

标签:sList,end,sdata,Delphi,OleVariant,High,Low,取值
来源: https://www.cnblogs.com/guorongtao/p/14366827.html