1
Answer

Barcode in Crystal Report in VB.Net

HI,

 I have created crystal report and i am generating Bar code image, Barcode string i am getting from data base so may code is - 

barcode = DashboardDS.Tables(0).Rows(i).Item("Barcode").ToString  // barcode string i am getting from data base

            Dim imgBarcpde As New System.Web.UI.WebControls.Image
            Using bitmap As New Bitmap(barcode.Length * 40, 80)
                Using G = Graphics.FromImage(bitmap)
                    Dim ofont As New Font("IDAutomationHC39M", 16)
                    Dim fpoint As New PointF(2.0F, 2.0F)
                    Dim blackBrush As New SolidBrush(Color.Black)
                    Dim whiteBrush As New SolidBrush(Color.White)
                    G.FillRectangle(whiteBrush, 0, 0, bitmap.Width, bitmap.Height)
                    G.DrawString(barcode, ofont, blackBrush, fpoint)
                End Using
                Using ms As New MemoryStream()
                    bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
                    Dim byteimage As Byte() = ms.ToArray()
                    Convert.ToBase64String(byteimage)
                    imgBarcpde.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteimage)
                End Using
                barcodeimage.Controls.Add(imgBarcpde) // binding barcode image
            End Using 

dsSummary.Tables("ObjectSummary").Rows.Add( ------ ) // here i want to bind this panel.

I am not getting this please help.


Answers (1)