Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > VB.NET Barcode Generation Guide > OneCode (Intelligent Mail) Barcode Generation in VB.NET Application
Download Barcode for .NET Suite Trial

USPS OneCode Barcode Generating SDK for VB.NET

How to Generate & Print OneCode Barcode Using VB.NET Class Code
  • Highly-rated VB.NET linear & 2d barcodes generating dll since 2003
  • Accurately generate & print USPS OneCode barcode images using VB.NET
  • Created USPS OneCode (Intelligent Mail) barcode images are industry-standard
  • Able to adjust bar color & human-readable text color of generated OneCode
  • Free to generate USPS OneCode barcode image in four different orientations
  • Support other 1d & 2d barcodes generation in VB.NET, like VB.NET QR Code & VB.NET Code 128
Overview of VB.NET OneCode Barcode
OneCode, known as Intelligent Mail barcode and the 4-State Customer Barcode, is used by USPS as a new method to sort and track letters and flats. It combines the capabilities of the POSTNET barcode and the PLANET Code barcode.
More information on USPS OneCode can be found here: .NET OneCode Barcode Details.
VB.NET OneCode Generating SDK - Install
The following is detailed tutorial on how to integrate OneCode barcoding component into your VB.NET project.
  1. How to Add Barcoding DLL to your VB.NET project reference?
    • Right click Solution Explorer and select "Add Reference...".
    • Click "Browse" to find Barcodelib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinForms.dll in the unzipped file, and click "OK" button.
  2. How to Add VB.NET Barcoding DLL to your Visual Studio Toolbox?
    • Right click in Toolbox and select "Choose Items...".
    • Click "Browse..." to select either BarcodeLib.Barcode.WinFroms.dll or Barcodelib.Barcode.ASP.NET.dll.
    • Check whether four new items are listed in the toolbox.
OneCode Generator SDK - Generate OneCode in VB.NET
The VB.NET barcode generation dll from BarcodeLib.com makes it extremely easy for you to generate linear OneCode barcode in .NET applications. After installing the barcoding dll to your VB.NET project, you just need to copy following free VB.NET class codes to generate high-quality USPS OneCode barcode image.
     Dim barcode As New BarcodeLib.Barcode.Linear()
barcode.Type = BarcodeType.ONECODE

' should be 20, 25, 29, or 31 digits.
barcode.Data = "0123456709498765432101234567891"

barcode.UOM = UnitOfMeasure.PIXEL
barcode.BarWidth = 2
barcode.BarHeight = 80
barcode.LeftMargin = 10
barcode.RightMargin = 10
barcode.TopMargin = 10
barcode.BottomMargin = 10

' more barcode settings here
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
barcode.BarColor = System.Drawing.Color.Blue

' save barcode image into your system
barcode.drawBarcode("c://onecode.png")

' generate barcode & output to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes()

' generate barcode to Graphics object
Graphics graphics = ...
barcode.drawBarcode(graphics)

' generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode()

' generate barcode and output to HttpResponse object
HttpResponse response = ...
barcode.drawBarcode(response)

' generate barcode and output to Stream object
Stream stream = ...
barcode.drawBarcode(stream)
VB.NET Barcoding SDK - Create OneCode in ASP.NET Web
There are two ways to generate OneCode barcode images in ASP.NET applications.
  1. Generate & Print OneCode Barcode in IIS
    • Download evaluation package and locate folder "barcode".
    • Copy the above folder to your IIS folder, eg. C:\inetpub.
    • Create a new virtual directory in your IIS, name it "barcode", and connect it to the above "barcode" folder in inetpub.
    • Restart IIS.
    • Navigate to:
      http://YourDomain:Port/barcode/linear.aspx?Type=24&Data=0123456709498765432101234567891
    • To create barcode image in your aspx or html page, you need pass the url to IMG tag src value.
      For example:
      <img src="http://YourDomain:port/barcode/linear.aspx?Type=24&Data=0123456709498765432101234567891" />
      Using this method, it will not generate any barcode images in your IIS server side.
More web stream URL parameters for OneCode generation in IIS are listed here: .NET OneCode Barcode Property Settings.
2. Create OneCode Barcode in ASP.NET Web Controller
  • Please add "BarcodeLib.Barcode.ASP.NET.dll" to your project reference and Visual Studio toolbox.
  • Find files "linear.aspx", "linear.aspx.cs" in the barcode folder and copy them to your ASP.NET project.
  • Drag & drop "LinearASPNET" to your ASP.NET web site.
  • Change barcode type to ONECODE, enter a 20-, 25-, 29-, or 31-digit characters and adjust other barcode properties in the Properties window.
VB.NET Barcoding SDK - Create OneCode in Windows Forms
The generation of OneCode in WinForms Application is also very simple.
  1. Add "BarcodeLib.Barcode.WinForms.dll" to your barcoding project and Visual Studio toolbox.
  2. Drag "LinearWinForm" to your WinForms project.
  3. Change the barcode type of generated barcode image to ONECODE and adjust its data value to a 20-, 25-, 29-, or 31-digit characters in the Properties window. (The default barcode type is Code 128.)
Generate Other Barcodes for VB.NET Application
VB.NET Linear Barcodes:
VB.NET Matrix Barcodes:
Generate Linear Barcodes for VB.NET Application: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, Code 128, EAN 8, EAN 13, EAN 128, Interleaved 2 of 5, ITF14 (UPC Shipping Container Symbol), MSI Plessey, OneCode, Planet, Postnet, RM4SCC (British Royal Mail 4-State Customer Barcode), UPC-A, UPC-E.
Generate 2D Barcodes for VB.NET Application: Data Matrix, PDF417, QR Code.