Barcode.dll - How to start

Barcode.dll 3d box

After installation this class reference, C#, VB, C++, VBS, ASP samples
can be found in your Start menu.

For frequently asked questions (FAQ) visit: www.lesnikowski.com/barcode/faq.aspx

For ordering info please visit: www.lesnikowski.com/barcode/buy.aspx

How to use Barcode.dll?
If you want to display barcode in user interface use Windows control or ASP.NET control

When you are printing barcode labels, use appropriate barcode class, as it will be more efficient: First you have to add reference to Barcode.dll in your project (see MSDN How to).
using Lesnikowski.Barcode;
using System.Drawing.Imaging;

//...

BaseBarcode barcode = BarcodeFactory.GetBarcode(Symbology.EAN13);

barcode.Number = "123456789012";
barcode.ChecksumAdd = true;

// Render barcode:
this.pictureBox1.Image = barcode.Render();

// You can also save it to file:
barcode.Save("c:\\barcode.gif", ImageFormat.Gif);
ASP.NET control
  1. Create new ASP.NET project
  2. Add new web.config file if you don't have one.
  3. Set up an HttpHandler in an ASP.NET web application, add the following code to your web.config file:

    Register an HTTP handler for IIS 6.0:

    <configuration>
      <system.web>
        <httpHandlers>
          <add verb="*" path="Barcode.axd"
            type="Lesnikowski.Web.BarcodeHttpHandler" />
        </httpHandlers>
      </system.web>
    </configuration>
    

    Register an HTTP handler for IIS 7.0 running in Integrated Mode:

    <configuration>
      <system.webServer>
        <handlers>
          <add name="BarcodeHttpHandler" verb="*"
            path="Barcode.axd"
            type="Lesnikowski.Web.BarcodeHttpHandler, Barcode"
            resourceType="Unspecified" />
        </handlers>
      </system.webServer>
    </configuration>
    

    Register an HTTP handler for IIS 7.0 running in Classic mode:

    <configuration>
      <system.web>
        <httpHandlers>
          <add verb="*" path="Barcode.axd" type="Lesnikowski.Web.BarcodeHttpHandler, Barcode" />
        </httpHandlers>
      </system.web>
      <system.webServer>
        <add name=BarcodeHttpHandler" verb="*"
          path="Barcode.axd"
          Modules="IsapiModule"
          scriptProcessor="FrameworkPath\aspnet_isapi.dll"
          resourceType="File" />
      </system.webServer>
    </configuration>
    
    ...remember to replace FrameworkPath with the correct path to the Aspnet_isapi.dll file.

    If you are using VS2003 use the following:

    <httpHandlers>
        <add
          verb="*"
          path="Barcode.axd"
          type="Lesnikowski.Web.BarcodeHttpHandler, Barcode"  />
    </httpHandlers>
    
  4. If BarcodeControl is not present in the toolbox:
    • use the right mouse button on toolbox,
    • click 'Choose items...' or 'Add/Remove Items'
    • Find 'BarcodeControl' on '.NET Framework Components' tab or click 'Browse' and point 'Barcode.dll' file
  5. Drag and drop BarcodeControl from toolbox to your webpage. This will add the reference to Barcode.dll to your project.
Windows control
  1. Create new WindowsForms project
  2. If BarcodeControl is not present in the toolbox:
    • use the right mouse button on toolbox,
    • click 'Choose items...' or 'Add/Remove Items'
    • Find 'BarcodeControl' on '.NET Framework Components' tab or click 'Browse' and point 'Barcode.dll' file
  3. Drag and drop BarcodeControl from toolbox to your Windows Form. This will add the reference to Barcode.dll to your project.