How to Generate Bar Code in C#?

Generate bar code C#, Barcodes make doing business much more efficient for companies. Barcodes provide a method to track and store information about goods, from individual items to large stocks of thousands or even millions of items. They serve an important role and provide advantages compared with manually entering information

You don’t need to remember any details of products to view details or to sale that product. So, just generate a bar code and sale it just by scanning it.

Usually we store product IDs or any other unique information of Product like IMEI number e-t-c.

There are many libraries to generate bar code in C#. In this tutorial we’ll use Zen Bar Code DLL File to generate Bar Code.

Steps to Generate Bar Code in C#:

  1. First of all Download the ZenBarCode DLL file from this Link
  2. Go to your solution explorer and right click on References and select Add Reference.
  3. In Reference Manager window, click on Browse button. Select ZenBarCode.dll from file dialogue window. Click on OK Button.
  4. You will find the ZenBarCode Reference in Solution Explorer.
  5. Next step is to add your controls to your Form. We need to add a TextBox, PictureBox and Button control from Toolbox.
  6. We’ll enter out text which we want to encrypt into bar code in the text box.
  7. double click on the button to create onClick event. And the add the following code:
 string barCode = txtBarCode.Text;
            try
            {
                Zen.Barcode.Code128BarcodeDraw brCode = 
                Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
                pictureBox1.Image = brCode.Draw(barCode, 60);
            }
            catch (Exception)
            {
              
            }

Now click on start button or press Ctrl+F5 key to run your program and enter some text in the textbox and click on generate button.

C# will encode your text into a bar code and display it on the picture box. Now you can print your bar code and try to scan it using any bar code scanner.

Printing Barcode:

Click on this Link to learn how to Print your generated bar code:

Watch full Video tutorial on YouTube: https://youtu.be/dojOKLaZSDw

Source Code:

14 thoughts on “How to Generate Bar Code in C#?

  • October 20, 2019 at 8:19 am
    Permalink

    I’m amazed, I must say. Rarely do I encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail on the head. The problem is an issue that not enough folks are speaking intelligently about. Now i’m very happy that I came across this during my search for something concerning this.|

  • October 20, 2019 at 8:29 am
    Permalink

    Excellent blog post. I definitely love this website. Stick with it!|

  • November 4, 2019 at 9:07 pm
    Permalink

    Loving the info on this site, you have done great job on the articles.

  • November 8, 2019 at 10:57 pm
    Permalink

    I don’t unremarkably comment but I gotta tell thankyou for the post on this great one : D.

  • December 30, 2019 at 12:12 pm
    Permalink

    Hi there, for all time i used to check web site posts here early in the morning, because i enjoy to gain knowledge of more and more.|

  • December 30, 2019 at 12:31 pm
    Permalink

    Thank you for some other wonderful article. Where else may just anybody get that kind of information in such a perfect means of writing? I’ve a presentation next week, and I’m on the search for such information.|

  • December 30, 2019 at 1:09 pm
    Permalink

    It’s appropriate time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or suggestions. Maybe you could write next articles referring to this article. I desire to read more things about it!|

  • January 7, 2020 at 10:19 am
    Permalink

    Terrific article! That is the kind of information that are supposed to be shared around the web. Disgrace on Google for now not positioning this post upper! Come on over and discuss with my site . Thanks =)|

  • January 7, 2020 at 10:21 am
    Permalink

    This site was… how do you say it? Relevant!! Finally I’ve found something which helped me. Thanks a lot!|

  • January 7, 2020 at 11:12 am
    Permalink

    This is my first time go to see at here and i am really happy to read all at alone place.|

  • May 24, 2020 at 11:58 pm
    Permalink

    Saved as a favorite, I really like your website!

  • May 26, 2020 at 8:34 pm
    Permalink

    “Hello! This post could not be written any better! Reading this post reminds me of my good old room mate! He always kept talking about this. I will forward this article to him. Fairly certain he will have a good read. Many thanks for sharing!”

  • May 28, 2020 at 7:19 pm
    Permalink

    Very neat blog article.Much thanks again. Awesome.

  • June 15, 2020 at 2:18 am
    Permalink

    This is very attention-grabbing, You’re an overly professional blogger. I’ve joined your feed and look ahead to in search of more of your excellent post. Additionally, I’ve shared your website in my social networks!

Comments are closed.