www.webdeveloper.com
Results 1 to 15 of 15

Thread: Generate BarCode

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    4

    Generate BarCode

    Hai,

    How to generate barcode and how to read that BarCode in .Net using C#, anybody can help me?

  2. #2
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,
    not sure if this will help you.

    You have to purchase a barcode reader(of course)
    The barcode reader will come with drivers and software for interfacing with your PC.
    The software will connect to your database.
    The sofware will allow you to create barcodes for your products using data in your database.

    Hope this helps
    ----------------------------------

  3. #3
    Join Date
    Jun 2004
    Location
    Kansas City, MO
    Posts
    1,607
    Here is some code that i have in asp. While it might not be the best, it does get the job done for certian things.

    I dont remember where the web site is that i grabbed it from but i left the header in tack. The web address does not take you to the app but you might be able to search and find it.

    I have used it for reports where i put the barcode at the bottom of the report and then the user on the production floor can scan the report and it will bring up the record for them.

    Hope this helps.

    Code:
    <%
    '
    ' Barcode Generator (c) 2003, Lake Avenue Church, www.lakeave.org
    '
    ' This program will generate the simpler Code39 (or Code 3-for-9) barcodes.
    ' You'll find these barcodes on staff and student ID badges, video rental
    ' cards and so on.
    '
    ' Basically, the code starts and ends with an asterisk.
    ' Inbetween the *'s, you can use - , $ / + %, space, A-Z and 0-9.
    '
    ' Code39 works with alternating bands of black and white. Each character
    ' is represented by 7 bands. The band is either wide or narrow. Inbetween
    ' each character there is a band of white the same width as the narrow band.
    '
    ' This code looks for the string strBarCode, which is not defined in this
    ' code. It's assumed that you would define the variable and then call the
    ' program as an include.
    '
    ' Height and Width are defined by the variables numWidth and numHeight,
    ' allowing you to customize as needed.
    '
    ' The code could probably be optimized and cleaned up; this was just a quick
    ' program to solve a need we had here. If you find the code useful, I'd
    ' love to hear from you. James Lamb, jamesl@lakeave.org
    '
    %>
    <%
    redim a(44)
    a(1)="1wnnwnnnnw"
    a(2)="2nnwwnnnnw"
    a(3)="3wnwwnnnnn"
    a(4)="4nnnwwnnnw"
    a(5)="5wnnwwnnnn"
    a(6)="6nnwwwnnnn"
    a(7)="7nnnwnnwnw"
    a(8)="8wnnwnnwnn"
    a(9)="9nnwwnnwnn"
    a(10)="0nnnwwnwnn"
    a(11)="Awnnnnwnnw"
    a(12)="Bnnwnnwnnw"
    a(13)="Cwnwnnwnnn"
    a(14)="Dnnnnwwnnw"
    a(15)="Ewnnnwwnnn"
    a(16)="Fnnwnwwnnn"
    a(17)="Gnnnnnwwnw"
    a(18)="Hwnnnnwwnn"
    a(19)="Innwnnwwnn"
    a(20)="Jnnnnwwwnn"
    a(21)="Kwnnnnnnww"
    a(22)="Lnnwnnnnww"
    a(23)="Mwnwnnnnwn"
    a(24)="Nnnnnwnnww"
    a(25)="Ownnnwnnwn"
    a(26)="Pnnwnwnnwn"
    a(27)="Qnnnnnnwww"
    a(28)="Rwnnnnnwwn"
    a(29)="Snnwnnnwwn"
    a(30)="Tnnnnwnwwn"
    a(31)="Uwwnnnnnnw"
    a(32)="Vnwwnnnnnw"
    a(33)="Wwwwnnnnnn"
    a(34)="Xnwnnwnnnw"
    a(35)="Ywwnnwnnnn"
    a(36)="Znwwnwnnnn"
    a(37)="-nwnnnnwnw"
    a(38)=".wwnnnnwnn"
    a(39)=" nwwnnnwnn"
    a(40)="*nwnnwnwnn"
    a(41)="$nwnwnwnnn"
    a(42)="/nwnwnnnwn"
    a(43)="+nwnnnwnwn"
    a(44)="%nnnwnwnwn"
    
    numNarrow=1.5
    numHeight=15
    
    strBarCode = "8227"
    strBarCode="*" & strBarCode & "*"
    strConv=""
    ' response.write strBarCode
    
    for t=1 to len(strBarCode)
    	for s=1 to 44
    		if mid(strBarCode,t,1)=left(a(s),1) then
    			strConv=strConv & right(a(s),9)&"s"
    		end if
    	next
    next
    
    ' response.write strconv & "<p>"
    
    b=1
    
    for t=1 to len(strConv)
    	if mid(strConv,t,1)="n" then
    		if b=1 then response.write "<img src=images/shim_black.gif width=" & numNarrow & " height=" & numHeight & ">"
    		if b=0 then response.write "<img src=images/shim.gif width=" & numNarrow & " height=" & numHeight & ">"
    		b=b+1
    		if b=2 then b=0
    	end if
    
    	if mid(strConv,t,1)="w" then
    		if b=1 then response.write "<img src=images/shim_black.gif width=" & numNarrow*2 & " height=" & numHeight & ">"
    		if b=0 then response.write "<img src=images/shim.gif width=" & numNarrow*2 & " height=" & numHeight & ">"
    		b=b+1
    		if b=2 then b=0
    	end if
    
    	if mid(strconv,t,1)="s" then
    		response.write "<img src=images/shim.gif width=" & numNarrow & " height=" & numHeight & ">"
    		b=1
    	end if
    next
    %>
    Need the 2 images as well
    Attached Images Attached Images

  4. #4
    Join Date
    Apr 2013
    Posts
    26
    in fact, that is not a tough task. i think you just need to employ a barcode generator to do that.there are many of them on the internet , you can just download one and follow the turioals . using a barcode generator is much easier and more convenient, yo ucan have a try, good luck!

  5. #5
    Join Date
    Feb 2013
    Location
    USA
    Posts
    40
    hi,
    Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.It is extremely helpful for me.
    regards
    |Shawn

  6. #6
    Join Date
    May 2013
    Posts
    1
    One thing that needs be made clear is that there are different kinds of barcode generator according to different platforms. So first you should make sure which platform you would like to create barcode in. For example, if you want to create barcode in C#, you should make choose one of these types barcode generators: C# barcode generator library in ASP.NET and C# barcode generator library for WinForms. Make use which is one is suitable for you and then make full use of Google. Of course, there are many other types of barcode generators, you can check by yourself. This is just an example.

  7. #7
    Join Date
    May 2013
    Location
    Surendranagar Gujarat India
    Posts
    55
    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
    AutoEventWireup="false" Inherits="BarCodes.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:Image id="myBarCode" runat="server"></asp:Image>
    </form>
    </body>
    </HTML>

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    namespace BarCodes
    {
    /// <summary />
    /// Summary description for WebForm1.
    /// </summary />
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Image myBarCode;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    myBarCode.ImageUrl = "BarCode.aspx?code=31231";
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary />
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary />
    private void InitializeComponent()
    {
    this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion
    }
    }


    Kishor Makwana
    Software Engineer
    Insight Softech
    www.insightsoftech.com

  8. #8
    Join Date
    Apr 2013
    Posts
    26
    there are many ways to do that. If you wanna save these complicated steps and find a easy way, you can google barcode generator and you will find many useful tools, or google how to create barcode in c# to get instructive articles. Good luck I think some imaging sdk programmes can enable to quickly generate barcodes. i have use imaging sdkr which can original layouts hyperlinks, Images and tables retained in word ,text, image, Epub, html.but i forgot download the wedsite ,go to google. By the way , pay attention to your system platform, select the suitable one . I use a barcode generator driver found on the internet . Install it and it becomes a selectable option.Then you can generate barcodes in many formats in any program at all, including Adobe Acrobat . Just open the sdk, select barcode, and choice a form you want, then you can generate barcode in c#, vb, asp ,etc ,the task will be finished in several seconds. if you haven't found a good choice , you can have a try. best wishes.

  9. #9
    Join Date
    Aug 2013
    Posts
    30
    that's easy,rich resource will show if you search on the internet with the key word of barcode generator . similarly, you can find resource about barcode reader too using the search engine .

  10. #10
    Join Date
    Aug 2013
    Posts
    30
    have you find the solution about creating barcode ?

  11. #11
    Join Date
    Feb 2014
    Posts
    3
    Is there is any other way..?

  12. #12
    Join Date
    Jan 2014
    Posts
    23
    Thanks Gaurav, you have share a great information!

  13. #13
    Join Date
    May 2014
    Posts
    1
    Quote Originally Posted by P.Murugesan View Post
    Hai,

    How to generate barcode and how to read that BarCode in .Net using C#, anybody can help me?
    You want to create and read barcode on windows or asp.net platform?

  14. #14
    Join Date
    Oct 2013
    Location
    USA, California
    Posts
    2
    I agree with Ribeyed. It is an easy way. But I use application from Qulix Systems for BarCode in .Net. This was more effective for my project.

  15. #15
    I don't think there is any other way to do this task.....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles