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.
The following is detailed tutorial on how to integrate OneCode barcoding component into your VB.NET project.
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.
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 AsNew BarcodeLib.Barcode.Linear() barcode.Type = BarcodeType.ONECODE
' should be 20, 25, 29, or 31 digits. barcode.Data = "0123456709498765432101234567891"
' 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.
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.
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.
Add "BarcodeLib.Barcode.WinForms.dll" to your barcoding project and Visual Studio toolbox.
Drag "LinearWinForm" to your WinForms project.
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.)