Barcodes not printing with value from Fields

5 posts, 0 answers
  1. Jack Voss
    Jack Voss avatar
    27 posts
    Member since:
    May 2010

    Posted 28 Sep 2010 Link to this post


    I have an application in WPF.
    It produces labels based on a sql query.
    Everything is working fine except for the barcode.  It will not print out anything if the value is set to a value from the Fields listing.  If I hard code the value to be equal to say "123" we get a barcode.  If I use the value that works fine in a text box above it, say Fields.Barcode  it prints nothing.

    Is this a known bug with the Telerik reporitng and barcodes ? 
    Should we be using binding ?

    At this point if it does not work we wil be going to try to recreate the label using windows reporting tools and a barcode font.  Wich will be disappointing.

    Jack Voss
  2. Honore
    Honore avatar
    5 posts
    Member since:
    Nov 2009

    Posted 29 Sep 2010 Link to this post


    I was having  the same issue today.

    Thanks to this forum, I resolved it by  attaching an ItemDataBinding event handler on the barcode as follows:

    private void ReportBarCode_ItemDataBinding(object sender, EventArgs e)
               Telerik.Reporting.Processing.Barcode bcode = (Telerik.Reporting.Processing.Barcode)sender;
               bcode .Value = ((Telerik.Reporting.Barcode)bcode.ItemDefinition).Value;
  3. Jack Voss
    Jack Voss avatar
    27 posts
    Member since:
    May 2010

    Posted 30 Sep 2010 Link to this post

    Thank you for this, but it still does not seem to be working.

    I added the following to my code in the report : 

    private string strSQLConnection = "XXXXXXXXXXXXXXXXXXXX";
                    public rptLabelsHeader()
                        /// <summary>
                        /// Required for telerik Reporting designer support
                        /// </summary>
                        MethodBase lmth = MethodBase.GetCurrentMethod();
                        string lsRoutineName = lmth.DeclaringType + "." + lmth.Name;
                        string lstrUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
                        SqlConnection lconn = new SqlConnection(strSQLConnection);
                        SqlCommand lcmd = new SqlCommand();
                        lcmd.CommandText = "uspGetLabelHeader";
                        lcmd.CommandType = CommandType.StoredProcedure;
                        lcmd.Connection = lconn;
                        lcmd.Parameters.Add(new SqlParameter("@Sys", "FEDEXLABELS"));
                        lcmd.Parameters.Add(new SqlParameter("@strWho", lstrUser));
                        SqlDataAdapter ldsa = new SqlDataAdapter(lcmd);
                        this.DataSource = ldsa;
                    private void barcode1_ItemDataBinding(object sender, EventArgs e)
                        Telerik.Reporting.Processing.Barcode bcode = (Telerik.Reporting.Processing.Barcode)sender;
                        bcode.Value = ((Telerik.Reporting.Barcode)bcode.ItemDefinition).Value;


    in the report designer I added the ItemDatabinding event


                // barcode1
                this.barcode1.BarAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
                this.barcode1.Checksum = false;
                this.barcode1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.079999998211860657, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.0099999997764825821, Telerik.Reporting.Drawing.UnitType.Inch));
                this.barcode1.Name = "barcode1";
                this.barcode1.ShowText = false;
                this.barcode1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.4199211597442627, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.19999980926513672, Telerik.Reporting.Drawing.UnitType.Inch));
                this.barcode1.Stretch = false;
                this.barcode1.Style.Font.Name = "Times New Roman";
                this.barcode1.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(14, Telerik.Reporting.Drawing.UnitType.Point);
                this.barcode1.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
                this.barcode1.Style.Visible = true;
                this.barcode1.Symbology = Telerik.Reporting.Barcode.SymbologyType.Code39;
                this.barcode1.Value = "=Fields.BarCode";
                this.barcode1.ItemDataBinding += new System.EventHandler(this.barcode1_ItemDataBinding);

    Still prints out blank, even though the text box just below it with the same value is printing out fine.


                // txtBarCode
                this.txtBarCode.Culture = new System.Globalization.CultureInfo("");
                this.txtBarCode.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.19789999723434448, Telerik.Reporting.Drawing.UnitType.Inch));
                this.txtBarCode.Name = "txtBarCode";
                this.txtBarCode.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2.5, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.19789999723434448, Telerik.Reporting.Drawing.UnitType.Inch));
                this.txtBarCode.Style.Font.Name = "Times New Roman";
                this.txtBarCode.Value = "=Fields.BarCode";

    I exported the labels from the wpf viewer and now I see in the PDF an error about the barcode being too long at 24 characters?  Is there a maximum size limit in barcodes ? 

    I included a jpg image of the pdf and a jpg image of the label design. 
  4. Jack Voss
    Jack Voss avatar
    27 posts
    Member since:
    May 2010

    Posted 30 Sep 2010 Link to this post

    Well,  apparantly if I set the Stretch = true it will print the barcode.  But it is not readable by our scanners.

    I can get a barcode to display using a text box and a true type font that we currently use, but when it prints it prints from the view it prints the barcode as wingdings as opposed to the barcode font. 

  5. Peter
    Peter avatar
    1631 posts

    Posted 01 Oct 2010 Link to this post

    Hi Jack Voss,

    When you set the Barcode's Stretch property to true the barcode will be stretched to fill the entire area of the Barcode report item. The widths of the bars and spaces are adjusted accordingly. This may lead to a barcode that has too many elements that can't be printed correctly due to a low resolution printer or/and scanner. Thus our suggestion is to try increase the Barcode item's size.

    For the barcode font printed as wingdings our suggestion is to make sure you have the barcode font on the local computer.

    Additionally you can check out the Invoice demo report that came with your installation of Telerik Reporting for an example that uses the Barcode item with data from the AdventureWorks database.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top