How to add BarCode to DataBand - Creating a report by using code
How to add BarCode to DataBand by using the example from
How to add BarCodeQR
var barCodeQR = new FastReport.Barcode.BarcodeQR();
//Set barcode Text
// add it to DataBand
data1.Objects.Add(barCodeQR);
In the Visual Studio Designer it shows...
CS1503: Argument 1:cannot convert from 'FastReport.Barcode.BarcodeQR' to 'FastReport.Base'
Using Visual Studio Pro 2019, .NET 5
Comments
Thank you, that was very helpful...here's how I did the code in .NET 5
//Create the BarcodeObject Base
var barcodeObjectQRBase = new FastReport.Barcode.BarcodeObject
{
Name = "Barcode48",
Left = FastReport.Utils.Units.Centimeters * 14f,
//Barcode48.Left = 500;
Top = FastReport.Utils.Units.Centimeters * 16.25f,
Width = FastReport.Utils.Units.Centimeters * 4.25f,
Height = FastReport.Utils.Units.Centimeters * 4.4f,
AutoSize = false,
Text = "www.google.com",
ShowText = false,
AllowExpressions = true
};
//Create the QRBarCode
var barcodeQR = new FastReport.Barcode.BarcodeQR()
{
ErrorCorrection = FastReport.Barcode.QRCodeErrorCorrection.L,
Encoding = FastReport.Barcode.QRCodeEncoding.UTF8,
QuietZone = true
};
//Set barcodeObjectQRBase to barcodeQR
barcodeObjectQRBase.Barcode=barcodeQR;
//Add to dataBand
dataBand.Objects.Add(barcodeObjectQRBase);//In the coded example it was data1