home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD94128292000.psc / frmBarCode.frm (.txt) next >
Encoding:
Visual Basic Form  |  2000-08-29  |  9.8 KB  |  262 lines

  1. VERSION 5.00
  2. Begin VB.Form frmBarCode 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "CueCat BarCode Scanner v1.5"
  5.    ClientHeight    =   5205
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4740
  9.    Icon            =   "frmBarCode.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   5205
  14.    ScaleWidth      =   4740
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.Frame frameFormat 
  18.       Caption         =   "Formatting"
  19.       Height          =   1230
  20.       Left            =   45
  21.       TabIndex        =   4
  22.       Top             =   3915
  23.       Width           =   4650
  24.       Begin VB.OptionButton optFormat 
  25.          Caption         =   "This is a best buy receipt"
  26.          Height          =   195
  27.          Index           =   2
  28.          Left            =   180
  29.          TabIndex        =   7
  30.          Top             =   810
  31.          Width           =   2940
  32.       End
  33.       Begin VB.OptionButton optFormat 
  34.          Caption         =   "Do not format at all"
  35.          Height          =   195
  36.          Index           =   1
  37.          Left            =   180
  38.          TabIndex        =   6
  39.          Top             =   540
  40.          Width           =   2940
  41.       End
  42.       Begin VB.OptionButton optFormat 
  43.          Caption         =   "Use automatic formatting (Default)"
  44.          Height          =   195
  45.          Index           =   0
  46.          Left            =   180
  47.          TabIndex        =   5
  48.          Top             =   270
  49.          Value           =   -1  'True
  50.          Width           =   2940
  51.       End
  52.    End
  53.    Begin VB.PictureBox picCueCat 
  54.       AutoSize        =   -1  'True
  55.       Height          =   975
  56.       Left            =   45
  57.       Picture         =   "frmBarCode.frx":030A
  58.       ScaleHeight     =   915
  59.       ScaleWidth      =   900
  60.       TabIndex        =   3
  61.       Top             =   45
  62.       Width           =   960
  63.    End
  64.    Begin VB.Frame frameMain 
  65.       Caption         =   "BarCode Information"
  66.       Height          =   2805
  67.       Left            =   45
  68.       TabIndex        =   2
  69.       Top             =   1080
  70.       Width           =   4650
  71.       Begin VB.Label lblData 
  72.          Caption         =   "0"
  73.          Height          =   1050
  74.          Index           =   3
  75.          Left            =   90
  76.          TabIndex        =   15
  77.          Top             =   1665
  78.          Width           =   4455
  79.       End
  80.       Begin VB.Label lblStatic 
  81.          Alignment       =   1  'Right Justify
  82.          AutoSize        =   -1  'True
  83.          Caption         =   "Other Information:"
  84.          Height          =   195
  85.          Index           =   3
  86.          Left            =   90
  87.          TabIndex        =   14
  88.          Top             =   1395
  89.          Width           =   1260
  90.       End
  91.       Begin VB.Label lblStatic 
  92.          Alignment       =   1  'Right Justify
  93.          AutoSize        =   -1  'True
  94.          Caption         =   "Barcode # Count:"
  95.          Height          =   195
  96.          Index           =   2
  97.          Left            =   90
  98.          TabIndex        =   13
  99.          Top             =   855
  100.          Width           =   1260
  101.       End
  102.       Begin VB.Label lblData 
  103.          AutoSize        =   -1  'True
  104.          Caption         =   "0"
  105.          Height          =   195
  106.          Index           =   2
  107.          Left            =   1530
  108.          TabIndex        =   12
  109.          Top             =   855
  110.          Width           =   90
  111.       End
  112.       Begin VB.Label lblData 
  113.          AutoSize        =   -1  'True
  114.          Caption         =   "0"
  115.          Height          =   195
  116.          Index           =   1
  117.          Left            =   1530
  118.          TabIndex        =   11
  119.          Top             =   585
  120.          Width           =   90
  121.       End
  122.       Begin VB.Label lblData 
  123.          AutoSize        =   -1  'True
  124.          Caption         =   "0"
  125.          Height          =   195
  126.          Index           =   0
  127.          Left            =   1530
  128.          TabIndex        =   10
  129.          Top             =   315
  130.          Width           =   90
  131.       End
  132.       Begin VB.Label lblStatic 
  133.          Alignment       =   1  'Right Justify
  134.          AutoSize        =   -1  'True
  135.          Caption         =   "UPC BarCode:"
  136.          Height          =   195
  137.          Index           =   1
  138.          Left            =   315
  139.          TabIndex        =   9
  140.          Top             =   585
  141.          Width           =   1035
  142.       End
  143.       Begin VB.Label lblStatic 
  144.          Alignment       =   1  'Right Justify
  145.          AutoSize        =   -1  'True
  146.          Caption         =   "UPC Type:"
  147.          Height          =   195
  148.          Index           =   0
  149.          Left            =   585
  150.          TabIndex        =   8
  151.          Top             =   315
  152.          Width           =   780
  153.       End
  154.    End
  155.    Begin VB.Frame FrameCatData 
  156.       Caption         =   "Enter CueCat Scanner Info Here"
  157.       Height          =   645
  158.       Left            =   1035
  159.       TabIndex        =   1
  160.       Top             =   360
  161.       Width           =   3660
  162.       Begin VB.TextBox txtCode 
  163.          Height          =   285
  164.          Left            =   90
  165.          MultiLine       =   -1  'True
  166.          TabIndex        =   0
  167.          Top             =   225
  168.          Width           =   3435
  169.       End
  170.    End
  171.    Begin VB.Label Label1 
  172.       AutoSize        =   -1  'True
  173.       Caption         =   "Make sure you turn off your CAPS LOCK"
  174.       Height          =   195
  175.       Left            =   1080
  176.       TabIndex        =   16
  177.       Top             =   45
  178.       Width           =   2865
  179.    End
  180. Attribute VB_Name = "frmBarCode"
  181. Attribute VB_GlobalNameSpace = False
  182. Attribute VB_Creatable = False
  183. Attribute VB_PredeclaredId = True
  184. Attribute VB_Exposed = False
  185. Option Explicit
  186. Dim sCueBuffer As String 'CueCat Data to store
  187. Dim sCodeType As String 'I could do this as a numeric value. However, I will do it as a string for easy viewing.
  188. Private Sub chkFormat_Click(Index As Integer)
  189.   txtCode.SetFocus
  190. End Sub
  191. Private Sub Form_Load()
  192. Dim i As Byte
  193.     For i = 0 To 3 'Clear all the Data from the Form
  194.       lblData(i).Caption = ""
  195.     Next i
  196. End Sub
  197. Private Sub optFormat_Click(Index As Integer)
  198. txtCode.SetFocus
  199. End Sub
  200. Private Sub txtCode_Change()
  201. Dim nDecimals As Byte
  202. Dim i As Integer
  203.   If InStr(txtCode.Text, vbCrLf) <> 0 Then 'check for <CR>
  204.                        
  205.     For i = 0 To 3 'Clear all the Data from the Form
  206.       lblData(i).Caption = ""
  207.     Next i
  208.                        
  209.     For i = 1 To Len(txtCode.Text) 'Search for the decimals
  210.       If Mid$(txtCode.Text, i, 1) = "." Then nDecimals = nDecimals + 1
  211.       
  212.       If nDecimals = 3 Then '3rd decimal is the start of the data to be decoded.
  213.         sCueBuffer = Mid$(txtCode.Text, i + 1) 'Remove the header prefix (before the 3rd decimal)
  214.         sCueBuffer = Left$(sCueBuffer, Len(sCueBuffer) - 3) 'Remove the trailing decimal and the <CR>
  215.         Exit For 'Exit For/Next Statement
  216.       End If
  217.     Next i
  218.            
  219.     If InStr(txtCode.Text, ".CNf7.") <> 0 Then 'CODE 128
  220.       sCodeType = "CODE128"
  221.       lblData(0).Caption = "CODE 128"
  222.     ElseIf InStr(txtCode.Text, ".ahb6.") <> 0 Then 'CODE 39
  223.       sCodeType = "CODE39"
  224.       lblData(0).Caption = "CODE 39"
  225.       lblData(3).Caption = "A-Z (uppercase), 0-9, period/decimal, space, $, /, + and %." & vbCrLf & "This version of the source does not implement A-Z or special characters."
  226.     ElseIf InStr(txtCode.Text, ".fHmc.") <> 0 Then 'UPC A (12 Digits)
  227.       sCodeType = "UPCA12"
  228.       lblData(0).Caption = "UPC A (10 + Check Digit)"
  229.       lblData(3).Caption = "UPC A consists of digits 0-9" + vbCrLf + "First Digit: Number System Digit" + vbCrLf + "Next 5 Digits: Manufacturer Code" + vbCrLf + "Next 5 Digits: Product ID" + vbCrLf + "Last Digit: Checksum Digit"
  230.     ElseIf InStr(txtCode.Text, ".cGf2.") <> 0 Then 'UPC 5 Digit Extension (18 Digits)
  231.       sCodeType = "UPC518"
  232.       lblData(0).Caption = "UPC / ISBN +5 Digit Ext. (18 Digits)"
  233.       lblData(3).Caption = "Consists of digits 0-9" + vbCrLf + "Found usually on Books and Magazines" + vbCrLf + "Also includes the ISBN number"
  234.     ElseIf InStr(txtCode.Text, ".cGen.") <> 0 Then 'UPC 5 Digit Extension (13 Digits) minus the 5 digits
  235.       sCodeType = "UPC513"
  236.       lblData(0).Caption = "UPC / ISBN (13 Digits)"
  237.       lblData(3).Caption = "Consists of digits 0-9" + vbCrLf + "Same as the 18 digit version minus the 5 digit extension." + vbCrLf + "For some reason the 13th digit seems to repeat the 12th digit."
  238.     Else 'All other formats that are not implemented or unknown
  239.       sCodeType = "UNKNOWN"
  240.       lblData(0).Caption = "Unknown/Not Implemented"
  241.     End If
  242.     txtCode.Text = ""
  243.     If optFormat(0).Value = True Then 'Format the Data
  244.       lblData(1).Caption = cc_space(cc_decode(sCueBuffer), sCodeType)
  245.     ElseIf optFormat(1).Value = True Then 'Do not format the Data
  246.       lblData(1).Caption = cc_decode(sCueBuffer)
  247.     ElseIf optFormat(2).Value = True Then 'Best Buy Receipt
  248.       'Check to make sure this is a Best Buy Receipt. Make sure its a Code 128 with 22 numbers.
  249.       If sCodeType = "CODE128" And Len(cc_decode(sCueBuffer)) = 22 Then
  250.         lblData(1).Caption = cc_decode(sCueBuffer)
  251.         lblData(3).Caption = cc_space(cc_decode(sCueBuffer), "BESTBUY")
  252.       Else
  253.         MsgBox "This is not a Best Buy Receipt.", 64
  254.         For i = 0 To 3 'Clear all the Data from the Form
  255.           lblData(i).Caption = ""
  256.         Next i
  257.       End If
  258.     End If
  259.     lblData(2).Caption = Len(cc_decode(sCueBuffer)) 'Return the length of the Barcode
  260.   End If
  261. End Sub
  262.