Search code examples
delphidelphi-xefastreport

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


Solution

  • 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.