Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not convert variant if type (Array Variant) into type (OleStr)

When try dynamicly bind TfrxBarCodeView from delphi get error 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;

in frxBarcode I have:

enter image description here

like image 351
user_odoo Avatar asked Sep 23 '19 10:09

user_odoo


1 Answers

I think you should set the Text of the barcode view itself instead of the text of the barcode of the barcode view, so:

TfrxBarCodeView(barcode).Text := value;

instead of

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

Tried to add a reference, but online documentation seems to be non-existent. But I bumped into this snippet on the FastReports forum, and this one in some, I don't know, website. Both are using TfrxBarCodeView.Text rather than TfrxBarCodeView.Barcode.Text.

like image 78
GolezTrol Avatar answered Nov 15 '22 16:11

GolezTrol