Generating a barcode for print

Posted on 2006-05-20
Last Modified: 2013-12-03

I am writing a program and i need to print labels with a barcode on it.

I was hoping to use the UPC-A barcode type as they are currently using that with a similar program.

I know i need a barcode font, but correct me if i am wrong, but dont you need to generate a start, stop and check digit to be added to the barcode? how would i go about this if so?


Question by:bryanford
    LVL 31

    Accepted Solution

    The start and stop bars are part of the font.  The check digit needs to be calculated by you.  Try this link for method of calculation:-
    LVL 3

    Expert Comment

    why don't you use this's very good one

    LVL 1

    Author Comment

    Thanks, i wasnt aware that the start and stop were in the font (should read the bloody manual i guess :p )

    I did a search for check digit calculation source code and found this. It seems to work OK:

    Public Function calcModulus10(ByVal sNumber As String) As Integer
    Dim tmpTotal As Integer
    Dim i As Integer, f As Byte, tmpStr As String
    Dim mdNums() As Integer
    For i = 1 To Len(sNumber)
      f = f + 1
      If f = 2 Then
        tmpStr = CInt(Mid$(sNumber, i, 1)) * 2
        If Len(tmpStr) > 1 Then
          tmpTotal = tmpTotal + CInt(Mid$(tmpStr, 1, 1)) + CInt(Mid$(tmpStr, 2, 1))
          tmpTotal = tmpTotal + CInt(tmpStr)
        End If
        tmpStr = ""
        f = 0
        tmpTotal = tmpTotal + CInt(Mid$(sNumber, i, 1))
      End If
    Next i
    If Right$(CStr(tmpTotal), 1) = "0" Then
      tmpTotal = 0
      tmpTotal = ((tmpTotal + 10) - CInt(Right$(CStr(tmpTotal), _
    1))) - tmpTotal
    End If
    calcModulus10 = tmpTotal
    End Function

    Thanks again

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Adobe Dreamweaver CC 2015

    Adobe Dreamweaver Creative Cloud is used by web designers and front-end developers and allows you to visualize your site in real-time as you code. This course covers exam objectives for the Adobe Certified Associate (ACA) certification.

    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    The viewer will learn how to dynamically set the form action using jQuery.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now