Here is the simple code to generate bar code and read it while you are dealing in the sale & purchase business.
First You have to add the iTextSharp.dll into the project for this right click on project in solution Explorer and add reference, browse and add it
Add Namespace = using iTextSharp.text.pdf;
Take Two Textboxes whose id item_id and item_code respectively and concate them to generate barcode for this:
- string id = item_id.Value;
- string name = item_code.Text;
- string bcode = string.Concat("BCD", id);
- Barcode39 bc39 = new Barcode39();
- bc39.BarHeight = 100;
- bc39.Code = bcode;
- bc39.X = 45;
- System.Drawing.Image bc = bc39.CreateDrawingImage(System.Drawing.Color.Black, System.Drawing.Color.White);
- //Response.ContentType = "image/gif"; ----- Show Barcode on window
- //bc.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); ------Show Barcode on window
- MemoryStream ms = new MemoryStream();
- bc.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
- byte[] a = ms.ToArray(); // ------- store barcode image into array byte
After this the next step to read barcode at the time of sale:

Santhakumar MunuswamyPosted Jul 28, 2015, 3:11 PM
Nice. Thanks for sharing