Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LISTVIEW AND EAN BARCODE

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
428
IT
In column1 of listview i have a EAN BAECODE, how to transform in a label BARCODE, in column2?

for example in column1 =1234567890, in column2 i need the have the image attached...

Link
 
EAN? Are you sure? Since neither your input nor your output seem to represent legitimate EAN
 
Have you tried to use any of barcode fonts?

combo
 
Combo, never....
barcode fonts? exists?
 
>FOR strongm, barcode!

That doesn't really answer my question.

And just to be clear here - simply downloading and using a barcode font (of which, as combo alludes, there are plenty available for download) does not mean you can then immediately display a legitimate barcode - unless you are expecting a v simple undefined linear code (e.g. no start or stop zones/characters, no check bits, etc, and which most barcode scanners will, as a result, not recognise) , which EAN is not. Hence my question.
 
Just wondering - is the image an EAN barcode without the numbers? The numbers are just for humans. The lines are for the barcode reader. Unlike the postal barcodes, the barcode reader doesn't need the line extensions or the numbers for EAN: it just looks for the spacing of the black and white lines.

You can download the EAN font from But this is EAN-13. There may be other EAN variants. Don't know if plain old EAN is the same as EAN-13. A bit rusty since I haven't worked on barcodes for 15 years.
 
> is the image an EAN barcode
Nope. Again, that was one of my points - "neither your input nor your output seem to represent legitimate EAN"

>There may be other EAN variants
There are indeeed

>You can download the EAN font
As I've previously pointed out (and as I am sure you are aware) there is more to a barcode than simply having a relevant font ...

We really need the OP to clarify their requirements
 
<sigh>

There are multiple barcode standards that each use a different method for encoding alphas and numerics (i.e there is not a single barcode font, there are several) - and indeed some barcodes ONLY encode alpha and some only encode numerics. They then support different numbers of characters (e.g EAN supports 13 characters, although there is a less common 8 character variant). Then, depending on the barcode, there will also be startbits, check characters, parity variants of the encoded characters, etc, etc, etc. And they each have their own format rules

So, my question to you is

Which actual type of barcode do you need? Codebar? Code 11? Code 25? Code 128? EAN 13? GS1 Databar? GS1-128? (there are many more ...)

If you cannot answer this, then it is tricky to provide advice. Note that your original post states that "i have a EAN BA[R]CODE" but - as I previously pointed out - neither your input (1234567890) is EAN compliant (wrong number of digits), nor is your output (the image you keep linking to) which for example does not have a start, center or end marker, nor does it appear to contain only legitimate EAN-13 symbols.

 
IMG_20210315_195757_o3fzyt.jpg
Strong,
Good point.
I need really a barcode in imsge.
I dont know the set of codebar.
Tks.
 
sal21, EAN13 is a 13 digit number, 12 digits and a checksum. If you want EAN13 there is a site that has the Function() and font. The free function is writen in French. I had no problem, many years ago, copying to a module and installing the font. I wrote a function and designed a font for UPC-A.
Consider donating a couple of $$ to Jean-Marie at the bottom of the page.
 
>barcode in imsge.
Ok, that's EAN-8 (which is partially covered in the link that 67peshawar294 provided)
 
ok, for the font.
But how to print the graphical barcode, in a listsubitem in Listview?

here the image and post (15 Mar 21 16:31):

Strognm,
i need to fill the column (CODICE), with a graphical barcode refered the value in BARCODE....
 
sal21, copy the Function() and place in a module. Name the Module EAN13.
Install the Font "Code EAN13.ttf"

In the Control Source for "CODICE" place, =upcean13([BARCODE])
Change the Font to "Code EAN13" and Font size to your liking around 36 for about a 1.5cm height.

Here is the Function()

Code:
Function upcean13(ByVal MYNUMBER)
If Len(MYNUMBER) = 13 Then MYNUMBER = Mid(MYNUMBER, 1, 11)

  Dim i%, checksum%, first%, EAN13$, tableA As Boolean
 
  'Vérifier qu'il y a 12 caractères
  If Len(MYNUMBER) = 12 Then
    'Et que ce sont bien des chiffres
    MYNUMBER = "0" & Mid$(MYNUMBER, 1, 12)
    
    For i% = 1 To 12
      If Asc(Mid$(MYNUMBER, i%, 1)) < 48 Or Asc(Mid$(MYNUMBER, i%, 1)) > 57 Then
        i% = 0
        Exit For
      End If
    Next

    If i% = 13 Then
      'Calcul de la clé de contrôle
      For i = 2 To 12 Step 2
        checksum = checksum + Val(Mid$(MYNUMBER, i%, 1))
      Next
      checksum = checksum * 3
      For i = 1 To 11 Step 2
        checksum = checksum + Val(Mid$(MYNUMBER, i, 1))
      Next
      MYNUMBER = MYNUMBER & (10 - checksum Mod 10) Mod 10
      'Le premier chiffre est pris tel quel, le deuxième vient de la table A
      upcean13 = Left$(MYNUMBER, 1) & Chr$(65 + Val(Mid$(MYNUMBER, 2, 1)))
      first = Val(Left$(MYNUMBER, 1))
      
      For i = 3 To 7
        tableA = False
         Select Case i
         Case 3
           Select Case first
           Case 0 To 3
             tableA = True
           End Select
         Case 4
           Select Case first
           Case 0, 4, 7, 8
             tableA = True
           End Select
         Case 5
           Select Case first
           Case 0, 1, 4, 5, 9
             tableA = True
           End Select
         Case 6
           Select Case first
           Case 0, 2, 5, 6, 7
             tableA = True
           End Select
         Case 7
           Select Case first
           Case 0, 3, 6, 8, 9
             tableA = True
           End Select
         End Select
       If tableA Then
         upcean13 = upcean13 & Chr$(65 + Val(Mid$(MYNUMBER, i, 1)))
       Else
         upcean13 = upcean13 & Chr$(75 + Val(Mid$(MYNUMBER, i, 1)))
       End If
     Next
      upcean13 = upcean13 & "*"   'Ajout séparateur central
      For i = 8 To 13
        upcean13 = upcean13 & Chr$(97 + Val(Mid$(MYNUMBER, i, 1)))
      Next
      upcean13 = upcean13 & Chr$(43)   'Ajout de la marque de fin
     
    End If
  End If
End Function

 
hi 67peshawar294 ,
but this function insert a grafical ean barcode, in a subitem of listview in column CODICE?

Have you see the image in one my post?

Link
 
sal21, Yes, I saw your image. DId you follow the instructions?
This was done about 20 years ago.
This is my UPC-A, but exactly the same as the method for the EAN13. (Different font for the UPC-A. I made a "Top Number" font for space purposes.)
Screenshot_7_pblasf.png

I don't know what else you would looking for?
Here is a single textbox of EAN13.
Screenshot_5_lzj6v2.png
 
Yep, you can do it with a listview, but you have to use OwnerDraw as I have previously outlined to you in e.g thread222-1803482

A quick proof of concept gives me the below. But I'm not going to post the code right now, going to give you a chance to figure it out yourself, since you pretty much have all the pieces now

lv3_h6rkkq.png


(If you have got a barcode reader you should find the barcodes match the numeric column)
 
>In the Control Source for "CODICE" place, =upcean13([BARCODE])

VB6 Listview columns do not have a control source. Nor can you (normally) set different fonts for different columns in a listview. (looks to me like you are talking about a continuous Access form)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top