【问题标题】:Could not convert variant if type (Array Variant) into type (OleStr)无法将变体类型(数组变体)转换为类型(OleStr)
【发布时间】:2019-09-23 10:17:53
【问题描述】:

当尝试从delphi动态绑定TfrxBarCodeView时出现错误Could not convert variant if type (Array Variant) into type (OleStr)。

var
     barcode: TfrxComponent;
     value  : String;
begin  
  barcode := frxBarcode.FindObject('BarCode1');

  value  := '184577787878';

  if barcode is TfrxBarCodeView then
     TfrxBarCodeView(barcode).BarCode.Text := value;

在 frxBarcode 我有:

【问题讨论】:

  • 尝试将value声明为字符串变量
  • @Fabrizio 我的错,值是字符串变量。

标签: delphi delphi-xe fastreport


【解决方案1】:

我认为你应该设置条形码视图本身的文本而不是条形码视图的条形码文本,所以:

TfrxBarCodeView(barcode).Text := value;

而不是

TfrxBarCodeView(barcode).BarCode.Text := value;

尝试添加参考,但在线文档似乎不存在。但是我在 FastReports 论坛上遇到了this snippet,在一些我不知道的网站上遇到了this one。两者都使用TfrxBarCodeView.Text 而不是TfrxBarCodeView.Barcode.Text

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-27
    • 1970-01-01
    相关资源
    最近更新 更多