|
Using ABarcode ActiveX in RDLC reports with Visual Studio .Net
This example assumes you already opened a new project and gone through the
preliminary steps.
Now follow these steps:
- Select Add New Item from the Project menu,
then click the Report icon and press the Add button.

- Insert a Table control from the Toolbox.
Drag & drop an Image control to the report; this one will show the barcode.

Then drag & drop the ProductID, ProductName
and any other column from the Datasources toolbox.

- Adjust these properties for the Image column:
- MIMEType: image/png
- Source: Database
- Value: =Fields!Barcode.Value

then Save the report.
- Add a new form to the project, insert a ReportViewer control into it,
and select the report just created in the previous step.

- Drop an ABarcodeX.Barcode control into the form,
then set its Visible property to False.

- Double click the form's title bar to open the code window,
then insert the following code to the Load event procedure:
Visual Basic .NET
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.ProductsTableAdapter.Fill(Me.DataSet1.Products)
For Each row As DataSet1.ProductsRow In Me.DataSet1.Products.Rows
Me.AxBarcode1.ValueToEncode = row.ProductID.ToString
row.Barcode = ImageToByte(Me.AxBarcode1.GetWMF)
Next
Me.ReportViewer1.RefreshReport()
End Sub
End Class
Visual C# .NET
private void Form3_Load(object sender, EventArgs e)
{
this.ProductsTableAdapter.Fill(this.DataSet1.Products);
Class1 cls1 = new Class1();
foreach (DataSet1.ProductsRow row in this.DataSet1.Products.Rows)
{
this.axBarcode1.ValueToEncode = row.ProductID.ToString();
row.Barcode = cls1.imageToByte(this.axBarcode1.GetWMF());
}
this.reportViewer1.RefreshReport();
}
- Set the new form as the Startup form in the Project properties (VB)
or code it to open in Program.cs (C#),
then run the application.
The form will show the report with barcodes.

- The ReportViewer allows you to export reports in different formats, in which case barcodes are also shown:

Using ABarcode ActiveX in Windows Forms
Using ABarcode ActiveX in Crystal Reports
Back to Barcode ActiveX control for .NET developers
|