Generating a barcode for print

Posted on 2006-05-20
Medium Priority
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

moorhouselondon earned 1000 total points
ID: 16727930
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:-


Expert Comment

ID: 16733974
why don't you use this component.....it's very good one



Author Comment

ID: 16890025
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month16 days, 10 hours left to enroll

864 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