Results 1 to 2 of 2

Thread: Barcode

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Mexico
    Posts
    16

    Question

    any one knows what are the calculations for a EAN13 barcode, I mean I have a label printer in wich I give the first 12 digits and the printer calculate the 13 digit, but the printer do it one by one and I need to process may codes.

    Thanks..

  2. #2
    Member Penavin's Avatar
    Join Date
    Oct 2001
    Location
    Sisak, Croatia
    Posts
    42

    Exclamation EAN13 Check digit calculation

    Hi!

    You can go to the link:
    http://www.planet-source-code.com/vb...xtCodeId=43144

    Code:
    '**************************************
    ' Name: _EAN13 CheckDigit calculate
    ' Description:Build the 13th CheckDigit number of EAN13 barcode
    ' By: StarNiell
    '
    ' Inputs:The barcode string format ie: "
    '     123456789012". The lenght of barcode string
    '     must be minimum 12 characters
    '
    ' Returns:The CheckDigit number of barcode
    '     string for the 13th position of code,
    '     or -1 if the lenght of input parameter is minor of 12
    '
    ' Assumes:The last number, at 13th position of EAN13 barcode,
    '     is a check on the entire code...
    '
    'This code is copyrighted and has' limited warranties.
    'Please see
    '     http://www.Planet-Source-Code.com/xq/ASP/txtCode
    '     Id.43144/lngWId.1/qx/vb/scripts/ShowCode.htm
    'for details.
    '**************************************
    
    Public Function getEAN13ChekDigit(ByRef sCodice As String) As Integer
        Dim i As Integer
        Dim iVettore(11) As Integer
        Dim iTmp As Integer
    
        If Len(sCodice) >= 12 Then
            For i = 0 To 11
                iVettore(i) = Val(Mid(sCodice, i + 1, 1)) * (1 + ((i And 1) * 2))
                iTmp = iTmp + iVettore(i)
            Next i
            getEAN13ChekDigit = 10 - (iTmp Mod 10)
        Else
            getEAN13ChekDigit = -1
        End If
    End Function
    Penavin

Posting Permissions

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



Click Here to Expand Forum to Full Width