Using VB.Net code to create a barcode in SSRS RRS feed

  • Question

  • I am attempting to design a barcode to implement into my report. I am using  this guide to do so Code 128 Barcode in SSRSI'm receiving an error in my custom code on line 7 that says Name 'objGraphic' is not declared. I'm also open to other alternatives to implementing a barcode in my report preferably free.

    Function PaintBox(ByVal level As String) As System.Drawing.Bitmap
        Dim objBitmap As System.Drawing.Bitmap
    objBitmap = New System.Drawing.Bitmap(3,3)
    GenCode128.Code128Rendering.MakeBarcodeImage(level, 1, True)
    Return objBitmap End Function
    Function PaintBoxBmp(ByVal level As String) As Byte()
    Dim bmpImage As System.Drawing.Bitmap
    bmpImage = PaintBox(level)
    Dim stream As System.IO.MemoryStream = New IO.MemoryStream
    Dim bitmapBytes As Byte() bmpImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
    bitmapBytes = stream.ToArray
    Return bitmapBytes
    End Function

    Monday, July 1, 2019 2:30 PM

All replies

  • Hi

    There seems to be *loads* of results in a Google search for 'GenCode128'

    HERE is one

    mostly in C#, but HERE is one in VB

    Regards Les, Livingston, Scotland

    • Edited by leshay Monday, July 1, 2019 4:56 PM
    Monday, July 1, 2019 4:56 PM
  • I don't understand how this would work with SSRS?
    Monday, July 1, 2019 7:02 PM
  • Hi,

    If your issue is solved,please shared us your solution and mark it as an answer.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, July 15, 2019 6:40 AM