I have written a small program in VB6 which prints barcode depending upon the user input. I have used Zebra printer software for design and using print to file option created a .prn file
I pass on the info to the variable in the prn file.This is working successfully from the past 8 months. Now all of sudden the barcode being printed is different from the type it should be. This barcode doesnt get scanned.
So I printed the same barcode serial no using Zebra software with Code 128. This is being read by the scanner.Using the same format I created .prn file and used to print the same serial no barcode from the VB program. Both of them are slightly differrent.
eg : SQRCXFT01645
Now I am unable to understand that how come a program working good for so long and there is no way the code was changed can bring up such issues.
I use the following function to pass on the variable info:
Function ReplaceStr(ByVal Origstr As String, ByVal Searchstr As String, ByVal ReplStr As String) As String
'Exchanges all occurrence of searchstr with replstr in origstr
'Here Searchstr is BARTEXT mentioned in .prn file whereas ReplStr is the serial no generated thru the program
'
Dim pos As Long
Dim i As Integer
Dim first As String
Dim last As String
'
' Origstr = ""
pos = 1
Dim tempnos As Integer
'
For i = 1 To 10 'find max. 10 occurrences
pos = InStr(pos, Origstr, Searchstr)
If pos > 0 Then
first = Mid$(Origstr, 1, pos - 1)
last = Mid$(Origstr, (pos + Len(Searchstr)), (Len(Origstr) - Len(first) - Len(Searchstr)))
Origstr = first + ReplStr + last
Else
Exit For
End If
Next i
ReplaceStr = Origstr 'Replace string with original data
End Function