C# Barcode Generator - Generating Barcodes in C#, C# ASP.NET
This article introduces how to use Barcode for .NET component to generate barcodes in your Visual C# ASP.NET website, C# classes, and C# Windows applications.
C# Barcode Generator Introduction
BarcodeLib Barcode for .NET is the most flexible and powerful C#.NET Bar Code generator.
Download free evaluation version
C# Barcode Generator Supporting Symbologies
- C# Barcode Generates 1D (Linear) Barcode Symbologies
- C# Barcode Generates 2D (Matrix) Barcode Symbologies.
C# Barcode - Project Setup
- To setup C# ASP.NET Website, C# Windows Application projects, just add BarcodeLib.Barcode.dll to your C# project reference.
C# Barcode - Generating Barcodes in C#.NET Class
1: BarcodeLib.Barcode.Linear.Linear barcode = new BarcodeLib.Barcode.Linear.Linear();
2: barcode.Type = BarcodeLib.Barcode.Linear.BarcodeType.CODE39;
3: barcode.Data = "123456789";
4: // other barcode settings.
5:
6: // save barcode image into your system
7: barcode.drawBarcode("c:/barcode.gif");
The above code is written in Visual C# 2005
- Create an linear barcode object (BarcodeLib.Barcode.Linear.Linear).
- Set barcode type to Code 39
- Set your encoded barcode value
- Draw barcode image into a GIF file
C# Barcode - Generating Barcode in ASP.NET Webstie
- Copy folder barcode from your downloaded Barcode for .NET trial package, to your IIS folder, e.g. C:\Inetpub.
- Create a new virtual directory barcode.
- Restart IIS.
- Test your installation, goto http://YourDomain:port/barcode/linear.aspx?Type=CODE39&Data=12345678
- To create barcode image in your ASP.NET application, you can pass the url to IMG tag src value.
For example, <img src="http://YourDomain:port/barcode/linear.aspx?Type=CODE39&Data=12345678" />
C# Barcode - Generating Barcodes in Windows Applications
- Add Reference BarcodeLib.Barcode.dll to your project. Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
- In your .NET windows project, right click mouse over Refereces in your Solution Explorer window. Then click menu "Add Reference ...".
- Add BarcodeLib.Barcode.dll to your project.
- Add barcode library to your Visual Studio Toolbox.
- Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
- Right click Toolbox, click menu Choose Items...
- Goto .NET Framework Components tab.
- Check component LinearWinForm, and its namespace is BarcodeLib.Barcode.Linear
- If no component found, click Browse... button and select BarcodeLib.Barcode.dll file.
- Now you can see the component displayed on Toolbox. You can drag LinearWinForm on your form, change barcode setting through properties widnow.
Other Related Articles