PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Petrus Vorster on June 07, 2016, 05:11:02 PM

Title: Translate from VB6
Post by: Petrus Vorster on June 07, 2016, 05:11:02 PM
I have a little piece of code in VB6 that encodes EAN128 barcodes in the format I want.
There is for example DIM XYZ as BOOLEAN.

It passes the TRUE and FALSE values to XYZ in the module.

Never had to bother with this, but what would be the workaround in PB for "DIM XYZ AS BOOLEAN"??
Title: Re: Translate from VB6
Post by: Paul Squires on June 07, 2016, 06:05:10 PM
You can use a LONG in place of BOOLEAN. Or better yet, a BYTE.
Title: Re: Translate from VB6
Post by: Knuth Konrad on June 08, 2016, 01:21:47 PM
From the PBWin 10 help file, "Comparative Data Types Visual Basic 6":

VB Type   Format            PowerBASIC
Boolean   signed 16-bit    INTEGER

Title: Re: Translate from VB6
Post by: Petrus Vorster on June 08, 2016, 01:37:54 PM
HA! I didnt read that!
Thanks!
Lets hope by the weekend i will have this translated!
Looking forward to finishing this entire project....
Title: Re: Translate from VB6
Post by: Petrus Vorster on June 08, 2016, 03:33:34 PM
Keep your fingers crossed. Will test the actual scan tomorrow at work.
Title: Re: Translate from VB6
Post by: Chris Maher on June 08, 2016, 05:45:28 PM
Great work Petrus!

I can't get a good decode from the screen copy but it looks like it comes out as this:

StartB FNC4 R FNC4 C SubsetC 12 34 56 78 SubsetB 9 FNC4 Z FNC4 A * Stop

(the * is the calculated check digit which currently decodes as "t" in SubsetB a value of 84)

I think it really needs to be constructed like this with all the FNC4 (value 100) removed and recalculating the check digit to replace the *

StartB R C SubsetC 12 34 56 78 SubsetB 9 Z A * Stop

I have attached a full verification report for you to look at but it only gives the basic detail of a pretty poor copy from screen.

Chris.
Title: Re: Translate from VB6
Post by: Petrus Vorster on June 09, 2016, 03:33:24 AM
Thanks Chris

Yes, I compared the string i got to an online encoder and there are major differences.
Last night I started to strip away the garbage of this encoding and started to construct my own module.
Since I only require the B set of the Code128 I can do away with a pile of encoding.
That comes down to just [START]STRING[CHECK][STOP].
THE [FNC1] - [FNC4] are not required, so i am dumping that.

I am nearly done with the MOD103 Check digit in the barcode, which on the B set is not that tough.
I am not trying to make a module for all the character sets, just to encode the UPU barcodes into EAN128.

This is quite a challenging, but most interesting journey. I appreciate the help very much!
Title: Re: Translate from VB6
Post by: Chris Maher on June 09, 2016, 04:46:32 AM
That's all good news.

Some of your original label samples were actually encoded just as CodeB, so you are correct, that must be ok to use too.

Often it is about just the space on the label and CodeC saves space once you get over the SubsetC/SubsetB overhead.

I suspect you have now done the hard part and so a bit more careful development and you will be there..

Good luck!

Chris.
Title: Re: Translate from VB6
Post by: Petrus Vorster on June 09, 2016, 03:36:26 PM
Chris, I think i am getting closer...
I never saw that i had to add 32 to the check-digit to find the Ascii equivalent. Thats sorted.
Apparently, in code set B, the string doesnt have to be "encoded" as long as the [STARTB], [CHECK] & [STOP] characters are.
Hope i understood that correctly.
Back to work tomorrow to see if this scans....
Title: Re: Translate from VB6
Post by: Petrus Vorster on June 11, 2016, 03:29:52 AM
 ;D ;D :D ;D :)
Cracked it this morning in the wee hours of the day.
Successful scans, Ean128 Encoding, UPU bar-codes on SUBSET B.

Chris and everyone else, thanks a million. Would not have been able to do this without you!!
Title: Re: Translate from VB6
Post by: Chris Maher on June 11, 2016, 06:30:45 AM
Excellent!

I had a feeling you would beat it in the end.

I am travelling at the moment but will scan your codes when I return.

Well done..

Chris.
Title: Re: Translate from VB6
Post by: Petrus Vorster on June 11, 2016, 08:15:19 AM
Thanks again so much!
There was no way in hell I would have been able to do this without all your advice!
:D