Link to home
Start Free TrialLog in
Avatar of SimonPrice33
SimonPrice33

asked on

12v input bypass....

Hi Expert,

im in a bit of a pickle...

i have 2 12v inputs going into a digital I/O that sends a signal to the computer via usb. the device is an advantec usb 4761.

the inputs to the computer work perfectly which which allow our access control system to allow people on and off of our site.

the issue im having is with the actual button on the screen. Since we moved away from using a volt free system the button no longer work and I need to make the application think its its receiving the necessary input from the usb I/O device.

I will post the code up in a moment when i am able to get back onto the machine.

any suggestions would be extremely gratefully recevied.

Avatar of SimonPrice33
SimonPrice33

ASKER

code below.

the button on screen is _Commans2_0

and in main_proc is where the button even needs to be started from

i have seen in the form

Command2_Click(Command2.Item(0), New System.EventArgs())

which resets the form so if anyone can help me trigger the last bits i'd be very happy.

ive also attached teh screen designer if that will also help...


Option Strict On
Option Explicit On

Friend Class out_wb1
	Inherits System.Windows.Forms.Form
	' British Sugar plc - Integrated Weighbridge System
	' BIC Out Weighbridge - With External Devices - Form = out_wb1
	'
	' beam_made - Timer
	' Command2(0) - Accept
	' Command2(1) - Setup Print
	' Command2(2) - Reset
	' Command2(3) - Re-Print Receipt
	' Command2(5) - Previous menu
	' Command2(6) - Trevor's Hidden Button (Off Screen)
	'               Focus is set to this button, which has
	'               no actions associated with it, to prevent
	'               a button being triggered by the striping
	'               of a stubcard.
	' entry_illegal - Timer
	' exiter1 - Timer
	' exiter2 - Timer
	' External_Devices - Timer
	' Frame 1 - Status Display
	' Frame 2 - Details Display
	' Frame 3 - Message Display
	' Frame 4 - External Device Status Display
	' indloop - Timer
	' Label 1 - Status Message - in Frame 1
	' Label 2 - Form Title - Out Weighbridge (With Externals)
	' Label 3 - Delivery detail display - in Frame 2
	'    Index 0 - Grower Name
	'    Index 7 - Weight
	'    Index 8 - Serial No.
	' Label 4 - Delivery detail headers - in Frame 2
	'    Index 0 - Stubcard No.
	'    Index 1 - Grower Name
	'    Index 9 - Weight
	'    Index 10 - Serial No.
	' Label 5 - Message display area - in Frame2
	' Label 6 - Last transaction details - in Frame2
	' Label 7 to 14 - External Device Staus Displays
	' lightbeam_broke_timer - Timer
    ' ScaleRef - Comms to Avery L200
    ' MSComm_Term - Comms to Driver's Display
    ' remake_LBs - Timer
    ' Text1 - Stubcard Number entry - Frame 2
    ' Timer1 - Timer
    ' veh_enters - Timer
    ' veh_exit - Timer
    '
    ' History
    ' Date      Ver  Author     Description
    ' =============================================================
    ' 01-May-98 1.0  I.Galloway Initial create
    ' 01-May-99 2.0  T.S.Mills  Mods to standardise, format and to
    '                           speed up processing, plus changes
    '                           from the post-implementation review
    ' 27-Jun-99 3.0  T.S.Mills  Added Doevents in last_proc to allow
    '                           weight and serial  number to display
    '                           Also removed error frame as it was
    '                           not used
    ' 07-Sep-99 3.1  T.S.Mills  Change qy.OpenResultset(rdOpenKeyset
    '                           to be qy.OpenResultset(rdOpenStatic
    '                           for all single row queries(less
    '                           overheads.
    '                           Also change updates/inserts to use
    '                           cn.Execute (sql)
    ' 15-Sep-99 3.2  T.S.Mills  Correct problem where Transaction
    '                           Complete message was not displayed
    ' 07-Feb-00 3.3  T.S.Mills  Correct lack of validation on what
    '                           type of card had been striped through
    '                           the Bar Code Reader - GIC, VIC or Stubcard.
    '                           Disable the PFKeys because striping
    '                           a bar code with the correct digits
    '                           at the front, would cuase the program
    '                           believe the PFKey had ben pressed.
    '                           Added a hidden button (Off Screen) so
    '                           that focus could be set to that, so
    '                           that when any key was pressed, or card
    '                           striped, it did not think one of the
    '                           proper buttons had been pressed.
    ' 22-May-00 4.1  AE Shinton Modified to accept the striping of a
    '                           vehicle card rather than a NEDAP or
    '                           stub card to initiate transaction.
    '                           Load and beet receipts now printed using
    '                           Zebra printer rather than Mannesman
    '                           guilotine printer.
    ' 21-Aug-00 4.2  T.S.Mills  Minor corrections and cosmetics
    ' 24-Aug-00 4.3  T.S.Mills  Remove Load_Date from all BIC SQL
    '                           selects and updates
    ' 07-Sep-00 4.4  T.S.Mills  Increase information in error message
    '                           when Load incorrectly sampled
    ' 09-Oct-00 4.5  T.S.Mills  Remove F8 button and its processing
    '                           Change Tally printing to reduce
    '                           duplication of code.
    ' 13-Aug-01 4.5  T.S.Mills  Remove F numbers from screen and text
    '                           messages.
    ' 11-Jan-02 4.6  A.Shinton  For new drivers display
    ' 24-May-02 4.7  T.S.Mills  Added new error message display
    '                           Also prevent processing of a vehicle
    '                           when there is no load record
    ' 29-Jul-02 4.8  T.S.Mills  Added correction for BUG in ODBC and
    '                           ADO which has an implicit Commit, and
    '                           therefore prevented Rollback working
    '                           properly. Also removed data_to_buffer
    '                           to BIC_Common.bas
    ' 07-Oct-02 4.9  T.S.Mills  Added funtionality to bypass problem
    '                           caused when attempting to switch to
    '                           the Sundries menu when there is a
    '                           vehicle on the induction loop
    ' 08-Sep-03 4.10 T.S.Mills  Truncate Vehicle Id to remove extraneous
    '                           space added when new Vehicle Id Cards
    '                           were printed for the 2003/4 campaign
    ' 16-Sep-03 4.11 T.S.Mills  Change to check length of card striped
    '                           as VIC to determine what action to take
    ' 16-Oct-03 4.12 T.S.Mills  Change way getting weight is handled
    '                           as a result of changes to GetWeight
    '                           recommended by Gareth Cavacuiti of Avery
    ' 25-Feb-04 4.13 T.S.Mills  Added debugging code to try to find problem
    '                           experienced at Cantley, of double weighing
    ' 21-Sep-04 4.14 T.S.Mills  Changed to allow VICs to be either 4
    '                           or 5 characters long
    ' 12-Nov-04 4.15 T.S.Mills  Added External Devices status displays
    ' 21-Feb-05 4.16 T.S.Mills  Corrected error handling and added
    '                           further debug messages
    ' 17-Feb-05 4.17 T.S.Mills  Added print on tally printer when a weight
    '                           is cancelled, or multiple ENQs are sent
    '                           to the Avery. Added warning when out of
    '                           Campaign. Corrected error handling in
    '                           Text1.Keypress for a Finished Grower
    ' 05-May-05 4.18  A.Shinton Added Access control door controller
    '                           modifications.
    ' 09-Aug-05 4.19  AEShinton Option for owb with externals with
    '                           no access control
    ' 22-Sep-05 4.20 T.S.Mills  Reset GetW after printing Beet Receipt
    '                           so that when Reset is pressed to switch
    '                           to Sundries operation, it wont print
    '                           an extra line on the Tally print
    '                           saying Weight Cancelled
    ' 17-Oct-05 4.21 T.S.Mills  Reduced length of Timeout message
    '                           Set focus to hidden button in Text1
    ' 07-Nov-05 4.22 T.S.Mills  Changed format of PrintOWBTally
    '                           On a mixed traffic weighbridge
    '                           added checking for Auto Cycle being
    '                           ON when Reset is clicked, to prevent
    '                           Previous Menu being selected until
    '                           Auto Cycle is turned off adn Reset
    '                           clicked
    ' 19-Sep-06 4.23 G.Lovell   Changes to use Croplands database
    '                           instead of BIC
    ' 24-Jul-07 4.24 G.Lovell   Increased time periods from 6 to 8
    ' 20-Aug-10 4.25 G.Lovell   Changes for trading standards (removal of traffic lights and induction loop)
    ' =============================================================
    ' 'force declarations

    Dim contract_nr As String
    Dim vehicle_nr As String
    Dim stubcard_nr As String
    Dim con_factory As String
    Dim con_name As String
    Dim haulier_code As String
    Dim atd_week As String
    Dim atd_day As String
    Dim atd_left As String
    Dim road_reg As String
    Dim in_time As String
    Dim in_wt As Integer
    Dim in_wt_serial_nr As Integer
    Dim in_station_id As String
    Dim out_wt As Integer
    Dim fname As String
    Dim decode_str As String
    Dim tmpstr As String
    Dim the_time As String
    Dim the_time_date As String
    Dim the_day As String
    Dim day_nr As String

    'Mod Jul-07 - time periods increased to 8
    Dim pdfrom(8) As String ' AES 5/00 Delivery pattern
    Dim pdto(8) As String ' AES 5/00 Delivery pattern
    Dim pdtoday(8) As String ' AES 5/00 Delivery pattern
    Dim pdtom(8) As String ' AES 5/00 Delivery pattern

    Dim Auto_Cycle As Boolean
    Dim gWaitOnOp As Boolean ' AES 5/00 Wait for op intervention
    Dim gSampleOK As Boolean ' AES 5/00 Vahicle sampled correctly flag
    Dim i As Short

    'Mod Sep-06 - new variable
    Dim lngContractID As Integer

    'Mod Aug-10 - new variable
    Dim vehicle_reg As String

    Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles _Command2_0.Click, _
                                                                                                                _Command2_1.Click, _
                                                                                                                _Command2_2.Click, _
                                                                                                                _Command2_3.Click, _
                                                                                                                _Command2_4.Click, _
                                                                                                                _Command2_5.Click

        Dim Index As Short = Command2.GetIndex(CType(eventSender, Button))

        Dim intResult As Short

        Select Case Index
            Case 0 'Accept'
                DebugInfo()
                DebugInfo("*** Command2 - Accept Button pressed")

                If gWaitOnOp = True Then ' AES 5/00 Op intervention ?
                    ' AES 5/00 YES !
                    gSampleOK = True ' AES 5/00 Flag vehicle sample OK
                    gWaitOnOp = False ' AES 5/00 Op no longer required

                    Exit Sub ' AES 5/00 Exit
                End If ' AES 5/00 End if

                ACCEPT_BTN = False
                Command2(0).Enabled = False

                OWB_AccessCtrl = True


                'If OWB_AccessCtrl = True Then ' AES 09/08/05 Access control initiated ?
                '    AccessDCTimer.Enabled = False ' AES 05/05/05 YES ! Disable Access DC signal
                'Else '                             GW                    11/4/2011
                '    AccessDCTimer.Enabled = False ' AES 05/05/05 YES ! Disable Access DC signal
                '    REM                      18/4/2011                     GW                            last_proc()
                'End If
                Exit Sub
            Case 1 'Setup Printers'
                DebugInfo()
                DebugInfo("*** Command2 - Setup Printers pressed")

                TestPrintOWBTally()

                ZebraTestReceipt() ' AES 5/00 Print test receipt

            Case 2 'Reset'
                DebugInfo()
                DebugInfo("*** Command2 - Reset Button pressed")

                If GetW = 2 Then
                    GetW = 0
                    DebugInfo("*** Command2.Click - Getting Date and Time")

                    'Mod Sep-06 - stored procedure returns formatted date/time
                    'Procedure sGetSysTimeDate(pTime, pTimeDate)

                    SqlCmd = "BEGIN BS_COMPk.sGetSysTimeDate(?,?); END;"
                    DebugInfo("SQL " & SqlCmd)
                    Dim dr As DataRow = Odbc_PopulateBlankParams(adoCn, SqlCmd, True)


                    DebugInfo("SQL Returned")
                    'Store result
                    'the_time_date = qy.rdoParameters(1).Value.ToString()
                    the_time_date = dr(1).ToString()

                    DebugInfo("*** Command2.Click - Printing Tally Print")

                    If GetW_ENQs > 1 Then
                        DebugInfo("*** Command2.Click - Multiple ENQs")
                        GetW_Msg = "Timeout - " & Str(GetW_ENQs) & " ENQs to Avery"
                        PrintOWBTallyMsg(stubcard_nr, the_time_date, GetW_Msg)

                        GetW_ENQs = 0

                    End If

                    'PrintOWBTally(99999, 0, Weight, SerialNo, stubcard_nr, "9999", the_time_date, "999999", "Weight Cancelled")
                    PrintOWBTallyEx(Me.Label2.Text, 99999, 0, Weight, SerialNo, stubcard_nr, "9999", the_time_date, "999999", "Weight Cancelled", STATION_ID.ToString(), con_name)

                End If

                If gWaitOnOp = True Then ' AES 5/00 Op intervention ?
                    ' AES 5/00 YES !
                    gSampleOK = False ' AES 5/00 Flag invalid vehicle sample
                    gWaitOnOp = False ' AES 5/00 Op no longer required

                    Exit Sub ' AES 5/00 Exit
                End If ' AES 5/00 End if

                cleanup()
                GATE = True
                'Mod Aug-10 - remove control of traffic lights
                'DIGIO_Output (LIGHT_RED)
                indloop.Enabled = True
                Label1.Text = "Awaiting Vehicle"
                Label5.Text = ""
                Label6.Text = ""

                ' 08-Nov-2010 Trevor Mills
                ' Commented out the opening of the drivers display as the new
                ' IWB PCs do not have a serial card, and the display is being
                ' replaced by a second monitor
                'If MSComm_Term.PortOpen = True Then
                '   MSComm_Term.PortOpen = False
                'End If

                'MSComm_Term.CommPort = 7
                'MSComm_Term.PortOpen = True

                If BIC_OUT_AUTO = True Then
                    'This bridge is also used for Sundries operations
                    DebugInfo("*** Command2 - Mixed Operation Beet Weighbridge")
                    'Mod Aug-10 - Auto_Cycle variable is always false now
                    'Auto Cycle is turned ON allowing automatic operations
                    DebugInfo("*** Command2 - Auto Cycle is ON")
                    STATES = state_trans(True, False, True, False, False, False, False, True, True, False, False, False, False, False, False)
                Else
                    'Bridge is not used for Sundries operations
                    DebugInfo("*** Command2 - Beet Weighbridge ONLY")
                    'UPGRADE_WARNING: Couldn't resolve default property of object to_driver(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    do_display = CType(to_driver("Awaiting Vehicle at", "Bridge Entrance"), Short)
                    STATES = state_trans(True, False, True, False, False, True, False, True, True, False, False, False, False, False, False)
                    ILL_ENTRY = False
                    DIGIO_Output((ALARM_OFF))
                End If


            Case 3 'Re-Print Receipt'
                DebugInfo()
                DebugInfo("*** Command2 - Re-Print Button pressed")

                RePrintOWBTally()

                ZebraReprintReceipt() ' AES 5/00 Reprint last receipt

            Case 4 'Mod Aug-10 - Store weight Details
                DebugInfo()
                DebugInfo("*** Command2 - Store Weight Details Button pressed")

                intResult = do_message("Store Details?" & vbCrLf & "Weight: " & Trim(CStr(Weight)) & "kg" & vbCrLf & "Serial No: " & SerialNo & vbCrLf & "Vehicle: " & vehicle_reg, 2)
                If intResult = 2 Then
                    STW_Weight = Weight
                    STW_SerialNo = SerialNo
                    STW_VehicleReg = vehicle_reg
                    STW_Comments = "Beet Weighbridge Vehicle In Weighing"
                    intResult = do_message("Details Stored", 1)
                End If

            Case 5 'Return to Previous Menu'
                DebugInfo()
                DebugInfo("*** Command2 - Previous Menu Button pressed")
                DebugInfo("*** Command2 - Going to BIC Menu")

                bicmenu.Show() : Me.Close()

            Case Else
        End Select

    End Sub

    Private Sub out_wb1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

        DebugInfo()
        DebugInfo("*** Starting Out Weighbridge (With Externals)")

        If OWB_AccessCtrl = False Then ' AES 09/08/05 Access control initiated ?
            Label2.Text = "Out Weighbridge (With Externals, No Access)" ' AES 09/08/05 no access
            Label15.Visible = False
            Label16.Visible = False
        Else
            Label2.Text = "Out Weighbridge (With Externals, With Access)" ' AES 09/08/05 with access
        End If

        gWaitOnOp = False ' AES 5/00 Init wait on op intervention

        CONTINUE_Renamed = False
        FROZEN = False
        WAIT_DOING = False
        INV_WEIGHT = False
        WEIGHT_BAD = False
        BROKELB = False
        FSIX = False
        FTEN = False
        THE_SET = False
        CHANGE_NR = False
        STUB_AGAIN = False
        ACCEPT_BTN = False
        ILL_ENTRY = False
        STUB_GIVEN = False

        Auto_Cycle = False

        If BIC_OUT_AUTO = True Then
            Command2(4).Visible = True 'show Store Weight Details button
            Command2(4).Enabled = False 'don't enable it yet
        End If

        exiter1.Enabled = False
        exiter2.Enabled = False
        'Mod Aug-10 - remove control of traffic lights
        'DIGIO_Output (LIGHT_RED)
        'Label10.BackColor = &H80FF&
        indloop.Enabled = True
        Label1.Text = "Awaiting Vehicle"
        Label5.Text = "Entry Beam Unbroken"

        ' 08-Nov-2010 Trevor Mills
        ' Commented out the openiong of the drivers display as tghe new
        ' IWB PCs do not have aserial card, and th edisplay is being
        ' replaced by a second monitor
        'If MSComm_Term.PortOpen = True Then
        '   MSComm_Term.PortOpen = False
        'End If

        'MSComm_Term.CommPort = 7
        'MSComm_Term.PortOpen = True
        'UPGRADE_WARNING: Couldn't resolve default property of object to_driver(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        do_display = CType(to_driver("Awaiting Vehicle at", "Bridge Entrance"), Short)

        STATES = state_trans(True, False, False, False, False, True, False, True, True, False, False, False, False, False, False)

        Command2(6).Enabled = True

        response = do_campaign()

        DebugInfo("*** Form Load - Awaiting Vehicle")

    End Sub

    Private Sub out_wb1_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        If (Not ScaleRef Is Nothing) AndAlso (ScaleRef.PortOpen = True) Then
            ScaleRef.PortOpen = False
        End If

        ' 08-Nov-2010 Trevor Mills
        ' Commented out the openiong of the drivers display as tghe new
        ' IWB PCs do not have aserial card, and th edisplay is being
        ' replaced by a second monitor
        'If MSComm_Term.PortOpen = True Then
        '   MSComm_Term.PortOpen = False
        'End If

        'Mod Aug-10 - remove control of traffic lights
        'DIGIO_Output (LIGHT_RED)
        'Label10.BackColor = &H80FF&

    End Sub

    ' AES 05/05/05
    ' Function to wait on drivers button no longer required. Superceded by signal
    ' received from door controller.
    ' AES 09/08/05 Reintroduced to allow operation with or without door controller.

    Private Sub MSComm_Term_OnComm()

        If OWB_AccessCtrl = True Then ' AES 09/08/05 Access control initiated ?
            Exit Sub ' NO! Exit
        End If

        DebugInfo("*** MSComm_Term_OnComm - Accept Button Pressed")

        If ACCEPT_BTN = True Then
            'If MSComm_Term.Input = "e" Then
            ACCEPT_BTN = False
            Command2(0).Enabled = False
            'do_display = CType(to_driver("Exit Beam Unbroken", ""), Short)
            do_display = CType(to_driver(DrvMsgs.VEHICLE_ENTRY), Short)
            last_proc()
            Exit Sub
            'End If
        End If

    End Sub

    Private Sub Text1_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Text1.Enter

        Text1.BackColor = System.Drawing.ColorTranslator.FromOle(&HFFFF)
        Text1.Text = ""

    End Sub

    Private Sub Text1_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Text1.Leave

        Text1.BackColor = System.Drawing.ColorTranslator.FromOle(&HFFFFFF)

    End Sub

    Private Sub Text1_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles Text1.KeyPress
        Dim keyascii As Short = CType(Asc(eventArgs.KeyChar), Short)

        Dim testnumber As Short

        On Error Resume Next

        'convert all input to uppercase
        keyascii = CType(Asc(UCase(Chr(keyascii))), Short)

        If keyascii = 13 Then
            If Text1.Text = "" Then
                GoTo EventExitSub
            End If
        Else
            GoTo EventExitSub
        End If

        DebugInfo("*** Text1_KeyPress - Vehicle Card being striped")

        Label5.Text = ""

        Select Case Len(Text1.Text)
            Case 4
                Text1.Text = Mid(Text1.Text, 1, 4)
            Case 5
                If Mid(Text1.Text, 5, 1) = " " Then
                    Text1.Text = Mid(Text1.Text, 1, 4)
                Else
                    Label5.Text = "Invalid Card Striped"
                    do_display = to_driver(DrvMsgs.DATA_ISSUE)
                    Text1.Text = ""
                    GoTo EventExitSub
                End If
            Case 6
                Label5.Text = "GIC Striped"
                do_display = to_driver(DrvMsgs.DATA_ISSUE)

                Text1.Text = ""
                GoTo EventExitSub
            Case Else
                Label5.Text = "Invalid Card Striped"
                do_display = to_driver(DrvMsgs.DATA_ISSUE)
                Text1.Text = ""
                GoTo EventExitSub
        End Select

        For testnumber = 1 To 4 ' AES 5/00 Accept vehicle card
            If Asc(Mid(Text1.Text, testnumber)) < 48 Or Asc(Mid(Text1.Text, testnumber)) > 57 Then

                Label5.Text = "Invalid Vehicle Number" ' AES 5/00 Accept vehicle card
                do_display = to_driver(DrvMsgs.DATA_ISSUE)

                Text1.Text = ""
                GoTo EventExitSub
            End If

        Next

        vehicle_nr = Text1.Text ' AES 5/00 Accept vehicle card
        Label5.Text = ""
        STUB_GIVEN = True
        Timer1.Enabled = False
        remake_LBs.Enabled = False
        Text1.BackColor = System.Drawing.ColorTranslator.FromOle(&HFFFFFF)

        DebugInfo("*** Text1_KeyPress - Vehicle Reg - " & Text1.Text)

        If Text1.Text = "9999" Then ' AES 5/00 Accept vehicle card
            test_proc()
            GoTo EventExitSub
        End If

        Text1.Enabled = False
        Label5.Text = ""
        main_proc()

EventExitSub:
        eventArgs.KeyChar = Chr(keyascii)
        If keyascii = 0 Then
            eventArgs.Handled = True
        End If
    End Sub

    Sub main_proc()

        On Error GoTo errorhandler

        DebugInfo("*** Main Proc")

        Label1.Text = "In Position"

        OWBObtainStub(vehicle_nr, stubcard_nr) ' AES 5/00 Obtain stubcard nr

        If stubcard_nr = "" Then
            gSampleOK = False
            No_Load_Data = True
            GoTo Check_Load_Sample
        End If

        'Mod Sep-06 - stored procedure gets contract and load data from stubcard
        'Procedure sFindContLoadDetl(pStubcardNr, pFoundInd, pInWt, pInWtSerialNr, _
        'pInStationId, pOutWt, pInTime, pContractNr, pName, pCFac, pVehRegNr, _
        'pHaulierCd, pLTCId, pContractId)

        SqlCmd = "BEGIN BS_BICPk.sFindContLoadDetl('" & stubcard_nr & "',?,?,?,?,?,?,?,?,?,?,?,?,?); END;"
        DebugInfo("SQL " & SqlCmd)
        Dim dr As DataRow = Odbc_PopulateBlankParams(adoCn, SqlCmd, True)

        DebugInfo("SQL Returned")

        On Error Resume Next

        'Retrieve values
        If CType(dr(0), Integer) = 0 Then
            gSampleOK = False
            No_Load_Data = True

            GoTo Check_Load_Sample
        Else
            On Error Resume Next
            contract_nr = dr(6).ToString()
            in_wt = CType(dr(1), Integer)
            in_wt_serial_nr = CType(dr(2), Integer)
            in_station_id = dr(3).ToString()
            in_time = dr(5).ToString()
            out_wt = CInt(Val(dr(4).ToString))
            If Len(in_time) < 4 Then
                in_time = "0" & in_time
            End If

            con_name = dr(7).ToString()
            con_factory = dr(8).ToString()
            haulier_code = dr(10).ToString()
            'Mod Sep-06 - store contract ID for later use
            lngContractID = CType(dr(12), Integer)
            'Mod Aug-10 - store vehicle reg for later use
            vehicle_reg = dr(9).ToString()

        End If

        gSampleOK = OWBSampleOK(stubcard_nr, vehicle_nr, contract_nr)



Check_Load_Sample:

        If gSampleOK = False Then ' AES 5/00 Vehicle corectly sampled ?
            ' AES 5/00 NO !
            If No_Load_Data = False Then
                DebugInfo("*** Main Proc - Sample Error - Load record exists")

                'A load record exists
                Label6.Text = "Incorrectly Sampled Load - " & "Stubcard " & stubcard_nr & ", Vehicle " & vehicle_nr & ", Contract " & contract_nr

                Label6.Visible = True
                Label5.Text = "Click Accept or Reset" ' AES 5/00 Display options
                'do_display = CType(to_driver("Press Help & Wait", ""), Short) ' AES 5/00 Inform driver
                do_display = to_driver(DrvMsgs.DATA_ISSUE)

                STATES = state_trans(False, True, False, False, True, False, False, False, False, False, False, False, False, False, False) ' AES 5/00 Enable\disable command buttons
            Else
                DebugInfo("*** Main Proc - Sample Error - No Load record")

                'A load record does NOT exist
                'Stop this transaction
                Label6.Text = "NO Load Record for this Vehicle - " & vehicle_nr
                Label6.Visible = True
                Label5.Text = "Click Reset"
                'do_display = CType(to_driver("Press Help & Wait", ""), Short)
                do_display = to_driver(DrvMsgs.DATA_ISSUE)

                STATES = state_trans(False, True, False, False, False, False, False, False, False, False, False, False, False, False, False) ' AES 5/00 Enable\disable command buttons
            End If

            gWaitOnOp = True ' AES 5/00 Wait for operator intervention

            Do  ' AES 5/00 Wait until op override or cancel
                System.Windows.Forms.Application.DoEvents()
            Loop Until gWaitOnOp = False

            Label6.Text = ""

            If gSampleOK = False Then ' AES 5/00 Transaction canceled ?
                ' AES 5/00 YES !
                Text1.Enabled = True ' AES 5/00 Allow vehicle nr entry
                Text1.Text = ""
                Text1.Focus()

                Command2_Click(Command2.Item(2), New System.EventArgs()) ' AES 5/00 Perform bridge reset

                Exit Sub
            End If

            ' AES 5/00 Invalid sample overriden

            STATES = state_trans(True, True, True, True, False, False, False, False, False, False, True, False, False, False, False)

        End If


        Label3(0).Text = con_name

        If con_factory = "" Then
            atd_left = "0"
            atd_day = ""
            decode_str = ""
            GoTo jump3
        End If

        'set up variables in global variable wback
        'for call to get_atds in GLOBALS.BAS
        'UPGRADE_NOTE: Erase was upgraded to System.Array.Clear. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
        System.Array.Clear(wback, 0, wback.Length)
        wback(1) = con_factory
        wback(2) = haulier_code
        wback(3) = contract_nr
        'Mod Sep-06 - new OWBget_atds needs Contract ID
        wback(6) = CStr(lngContractID)

        'call get_atds to return name, number and remaining atds
        OWBget_atds()

        'atd_week = wback(6)
        atd_left = wback(8)
        'decode_str = wback(9)


        'Mod Sep-06 - parameters changed on OWBObtainDeliveries
        OWBObtainDeliveries(lngContractID, pdfrom, pdto, pdtoday, pdtom) ' AES 5/00 Obtain delivery pattern


jump3:

        DebugInfo("*** Main Proc - Waiting On Driver")

        If OWB_AccessCtrl = False Then ' AES 09/08/05 Access control initiated ?
            Label5.Text = "Waiting on Driver. Click Accept" ' AES 09/08/05 reinstated
            'do_display = CType(to_driver(con_name, "Stripe Drivers Card "), Short) ' AES 05/05/05
            '                  rem                 GW           6/4/2011                do_display = to_driver(DrvMsgs.DAC_STRIPE) ' AES 05/05/05
            REM                       GW             18/4/2011                       need to weigh etc here, not later
            last_proc() ' Continue processing - weight now taken
            out_wt = Weight
            REM                       GW             18/4/2011                       need to weigh etc here, not later
            Dim cntrLine As String = "Contract :" & contract_nr & " - " & GetChars(con_name, 30)
            '                 Dim inWghtLine As String = "In Weight : " & in_wt.ToString() & " tonnes     Out Weight : " & out_wt.ToString() & " tonnes     Net Weight : " & (in_wt - out_wt).ToString() & " tonnes "
            '                                 GW                      12/4/2011                                    new button incorporated.
            Dim inWghtLine As String = "In Wt : " & in_wt.ToString() & " kg     Out Wt : " & out_wt.ToString() & " kg     Net Wt : " & (in_wt - out_wt).ToString() & " kg "
            do_display = to_driver(DrvMsgs.LOAD_DELIVERED, cntrLine, inWghtLine, DrvMsgs.BTN_CONFIRMATION)
            STATES = state_trans(False, True, False, True, True, False, False, False, False, False, True, False, False, False, False)
            AccessDCTimer.Enabled = True ' AES 05/05/05 Enable Access DC signal
            lightbeam_broke_timer.Enabled = False '                     GW          7/4/2011
            exiter1.Enabled = True '                                     GW          7/4/2011                 need indicator to print receipt after dac swiped
        Else
            'do_display = CType(to_driver(con_name, "Waiting on Driver "), Short) ' AES 09/08/05 reinstated

            REM                       GW             6/4/2011                       need to weigh etc here, not later
            last_proc() ' Continue processing - weight now taken
            out_wt = Weight
            REM                       GW             6/4/2011                       need to weigh etc here, not later

            Label5.Text = "Stripe Drivers Card or Click Accept" ' AES 05/05/05

            Dim cntrLine As String = "Contract :" & contract_nr & " - " & GetChars(con_name, 30)
            '                 Dim inWghtLine As String = "In Weight : " & in_wt.ToString() & " tonnes     Out Weight : " & out_wt.ToString() & " tonnes     Net Weight : " & (in_wt - out_wt).ToString() & " tonnes "
            Dim inWghtLine As String = "In Wt : " & in_wt.ToString() & " kg     Out Wt : " & out_wt.ToString() & " kg     Net Wt : " & (in_wt - out_wt).ToString() & " kg "
            do_display = to_driver(DrvMsgs.LOAD_DELIVERED, cntrLine, inWghtLine, DrvMsgs.DAC_CONFIRMATION)

            OWB_AccessCtrl = True
            STATES = state_trans(False, True, False, True, True, False, False, False, False, False, True, False, False, False, False)
            AccessDCTimer.Enabled = True ' AES 05/05/05 Enable Access DC signal
            lightbeam_broke_timer.Enabled = False '                     GW          7/4/2011
            exiter1.Enabled = True '                                     GW          7/4/2011                 need indicator to print receipt after dac swiped
        End If


        Command2(6).Focus()
        ACCEPT_BTN = True

        '            GW                      12/4/2011               If OWB_AccessCtrl = True Then ' AES 09/08/05 Access control initiated ?
        '            GW                      12/4/2011                   AccessDCTimer.Enabled = True ' AES 05/05/05 Enable Access DC signal
        '            GW                      12/4/2011                   lightbeam_broke_timer.Enabled = False '                     GW          7/4/2011
        '            GW                      12/4/2011                   exiter1.Enabled = True '            GW          7/4/2011                 need indicator to print receipt after dac swiped
        '            GW                      12/4/2011               End If

        Exit Sub

errorhandler:

        Error_Msg = "ERROR " & Str(Err.Number) & ": " & Err.Description
        IWB_Function = "BIC Out Weighbridge 1"
        IWB_Sub_Function = "Main_Proc"

        response = do_error("X")


    End Sub

    Sub last_proc()

        DebugInfo("*** Last Proc")

        On Error GoTo errorhandler

        WAIT_DOING = True
        Label5.Text = "Getting Weight..."

        DebugInfo("*** Last Proc - Getting Weight")

        GetW_ENQs = 0
        Illegal_Positioning = False

        Do
            System.Windows.Forms.Application.DoEvents()
            GetW = GetWeight(ScaleRef, INBOUND_COMPORT, Weight)
        Loop Until GetW <> 0

        WAIT_DOING = False
        Label5.Text = ""

        DebugInfo("*** Last Proc - GetW = " & Str(GetW) & " ENQs = " & Str(GetW_ENQs))

        'Mod Sep-06 - stored procedure returns formatted date/time
        'Procedure sGetSysTimeDate(pTime, pTimeDate)

        SqlCmd = "BEGIN BS_COMPk.sGetSysTimeDate(?,?); END;"
        DebugInfo("SQL " & SqlCmd)
        Dim dr As DataRow = Odbc_PopulateBlankParams(adoCn, SqlCmd, True)

        DebugInfo("SQL Returned")
        'Store result
        'the_time_date = qy.rdoParameters(1).Value.ToString()
        the_time_date = dr(1).ToString()

        If Illegal_Positioning = True Then
            PrintOWBTallyMsg(stubcard_nr, the_time_date, "Illegal Positioning during Get Weight")
        End If

        If GetW_ENQs > 1 Then
            GetW_Msg = "Timeout - " & Str(GetW_ENQs) & " ENQs sent to Avery"
            PrintOWBTallyMsg(stubcard_nr, the_time_date, GetW_Msg)

            GetW_ENQs = 0

        End If

        If GetW = 2 Then 'Got weight OK
        Else
            Select Case GetW
                Case 1 'Scale Error
                    Label5.Text = "Cannot get Weight. Click Reset"
                    'do_display = CType(to_driver("Cannot get Weight", ""), Short)
                Case 3 'Scale Unsteady
                    Label5.Text = "Avery Unsteady. Click Reset"
                    'do_display = CType(to_driver("Avery Unsteady", ""), Short)
                Case 4 'Weighbridge has not seen zero
                    Label5.Text = "Weighbridge has not seen zero. Click Reset"
                    'do_display = CType(to_driver("Weighbridge has not seen zero", ""), Short)
                Case Else
                    Label5.Text = "Weighbridge Error. Click Reset"
                    'do_display = CType(to_driver("Weighbridge Error", ""), Short)
            End Select

            do_display = to_driver(DrvMsgs.ACCESS_ISSUE, DrvMsgs.PRESS_HELP)


            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, False, False, False, False, False)
            Exit Sub
        End If

        If (Weight < MIN_OUT_WEIGH Or Weight > MAX_OUT_WEIGH) Then
            Label5.Text = "Weight outside limits. Click Reset"
            'do_display = CType(to_driver("Invalid Weight", ""), Short)
            do_display = to_driver(DrvMsgs.ACCESS_ISSUE, DrvMsgs.PRESS_HELP)

            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, False, False, False, False, False)
            Exit Sub
        End If

        Label3(7).Text = Str(Weight)
        Label3(8).Text = Str(SerialNo)
        Label5.Text = "Updating Records..."
        Timer1.Enabled = False
        remake_LBs.Enabled = False
        lightbeam_broke_timer.Enabled = False

        For i = 1 To 100
            System.Windows.Forms.Application.DoEvents()
        Next


        DebugInfo("*** Last Proc - Doing Database Updates")

        updates()

        DebugInfo("*** Last Proc - Printing Tally Print")

        'PrintOWBTally(in_wt, in_wt_serial_nr, Weight, SerialNo, stubcard_nr, vehicle_nr, the_time_date, contract_nr, "")
        PrintOWBTallyEx("Out WeighBridge", in_wt, in_wt_serial_nr, Weight, SerialNo, stubcard_nr, vehicle_nr, the_time_date, contract_nr, "", STATION_ID.ToString(), con_name)

        DebugInfo("*** Last Proc - Storing Beet Receipt")

        ZebraBeetReceiptStore(in_wt, in_wt_serial_nr, Weight, SerialNo, con_name, in_time, atd_left, stubcard_nr, vehicle_nr, the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, contract_nr, PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString(), pdfrom, pdto, pdtoday, pdtom, (contract_nr = ""))

        'TSM 12/07/2011 commented out code below as same procedure called, with the same values 
        'irrespective of whether access control is on or not
        'REM                 GW                          7/4/2011
        'If OWB_AccessCtrl = False Then
        '    REM          store values for later printing                     GW         18/4/2011                  
        '    ZebraBeetReceiptStore(in_wt, in_wt_serial_nr, Weight, SerialNo, con_name, in_time, atd_left, stubcard_nr, vehicle_nr, the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, contract_nr, PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString(), pdfrom, pdto, pdtoday, pdtom, (contract_nr = ""))
        '    '                     GW         18/4/2011
        '    'If contract_nr = "" Then
        '    '    ZebraLoadReceipt(in_wt, in_wt_serial_nr, Weight, SerialNo, con_name, in_time, atd_left, stubcard_nr, vehicle_nr, the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, contract_nr, PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString())
        '    'Else
        '    '    ZebraBeetReceipt(in_wt, in_wt_serial_nr, Weight, SerialNo, con_name, in_time, atd_left, stubcard_nr, vehicle_nr, the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, contract_nr, PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString(), pdfrom, pdto, pdtoday, pdtom)
        '    'End If
        '    '                     GW         18/4/2011
        'Else
        'REM          store values for later printing
        'ZebraBeetReceiptStore(in_wt, in_wt_serial_nr, Weight, SerialNo, con_name, in_time, atd_left, stubcard_nr, vehicle_nr, the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, contract_nr, PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString(), pdfrom, pdto, pdtoday, pdtom, (contract_nr = ""))
        'End If

        GetW = 0

        'Mod Aug-10 - enable Store Weight Details button
        If Command2(4).Visible Then
            Command2(4).Enabled = True
        End If

        DebugInfo("*** Last Proc - Exit Beam Unbroken")

        'do_display = CType(to_driver("Exit Beam Unbroken", ""), Short)
        If OWB_AccessCtrl = False Then
            REM           GW        18/4/2011                 do_display = to_driver("Thank You", DrvMsgs.TAKE_LOAD_RECEIPT)
            do_display = to_driver("", "", "Thank You" & vbCrLf & vbCrLf & DrvMsgs.TAKE_LOAD_RECEIPT, "")
        End If

        Label5.Text = "Awaiting on Driver"
        lightbeam_broke_timer.Enabled = False
        exiter1.Enabled = True

        REM                                  GW                    11/4/2011            STATES = state_trans(False, True, True, True, False, False, False, False, False, False, True, False, False, False, False)
        STATES = state_trans(False, True, True, True, False, False, False, False, False, False, False, False, False, False, False)

        DebugInfo("*** Last_Proc - Waiting for Next Vehicle")
        DebugInfo("")

        Exit Sub

errorhandler:

        Error_Msg = "ERROR " & Str(Err.Number) & ": " & Err.Description
        IWB_Function = "BIC Out Weighbridge 1"
        IWB_Sub_Function = "Last_Proc"

        response = do_error("X")


    End Sub

    Function state_trans(ByRef a As Boolean, ByRef b As Boolean, ByRef c As Boolean, ByRef d As Boolean, ByRef e As Boolean, ByRef f As Boolean, ByRef g As Boolean, ByRef h As Boolean, ByRef i As Boolean, ByRef j As Boolean, ByRef k As Boolean, ByRef l As Boolean, ByRef m As Boolean, ByRef n As Boolean, ByRef o As Boolean) As String

        Command2(6).Enabled = True

        'Values to Objects
        'a - Setup Printers
        'b - Reset
        'c - Re-Print Receipt
        'd
        'e - Accept
        'f - Return to Previous Menu
        'g - Text1
        'h - indloop (Wb1 ONLY)
        'i - entry_illegal (Wb1 ONLY)
        'j - veh_enters (Wb1 ONLY)
        'k - lightbeam_broke_timer (Wb1 ONLY)
        'l - veh_exit (Wb1 ONLY)
        'm - FROZEN
        'n - beam_made (Wb1 ONLY)
        'o - timer1 (WB1 ONLY)

        state_trans = ""
        If FROZEN = True Then
            If THE_SET = True Then
                Command2(0).Enabled = FTEN
                Command2(2).Enabled = FSIX
                'proc_delivery_timer.Enabled = False
                'lightbeam_broke_timer.Enabled = True
                THE_SET = False
                Exit Function
            End If

            If BROKELB = True Then
                'THE_SET=true
                If Command2(0).Enabled = True Then
                    FTEN = True
                Else
                    FTEN = False
                End If

                If Command2(2).Enabled = True Then
                    FSIX = True
                Else
                    FSIX = False
                End If

                Command2(1).Enabled = a
                Command2(2).Enabled = b
                Command2(3).Enabled = c
                Command2(0).Enabled = e
                Command2(5).Enabled = f
                Text1.Enabled = g
                If Text1.Enabled = True Then
                    Text1.Focus()
                End If

                Exit Function
            End If

            Command2(1).Enabled = last_state(1)
            Command2(2).Enabled = last_state(2)
            Command2(3).Enabled = last_state(3)
            Command2(0).Enabled = last_state(5)
            Command2(5).Enabled = last_state(6)

            Text1.Enabled = last_state(7)
            If Text1.Enabled = True Then
                Text1.Focus()
            End If

            indloop.Enabled = last_state(8)
            entry_illegal.Enabled = last_state(9)
            veh_enters.Enabled = last_state(10)
            lightbeam_broke_timer.Enabled = last_state(11)
            veh_exit.Enabled = last_state(12)
            beam_made.Enabled = last_state(13)
            Timer1.Enabled = last_state(14)
            FROZEN = m

            Exit Function
        End If

        last_state(1) = Command2(1).Enabled
        last_state(2) = Command2(2).Enabled
        last_state(3) = Command2(3).Enabled
        last_state(5) = Command2(0).Enabled
        last_state(6) = Command2(5).Enabled
        last_state(7) = Text1.Enabled
        last_state(8) = indloop.Enabled
        last_state(9) = entry_illegal.Enabled
        last_state(10) = veh_enters.Enabled
        last_state(11) = lightbeam_broke_timer.Enabled
        last_state(12) = veh_exit.Enabled
        last_state(13) = beam_made.Enabled
        last_state(14) = Timer1.Enabled

        Command2(1).Enabled = a
        Command2(2).Enabled = b
        Command2(3).Enabled = c
        Command2(0).Enabled = e
        Command2(5).Enabled = f

        Command2(6).Enabled = True

        Text1.Enabled = g
        If Text1.Enabled = True Then
            Text1.Focus()
            Command2(6).Enabled = True
        End If

        indloop.Enabled = h
        entry_illegal.Enabled = i
        veh_enters.Enabled = j
        lightbeam_broke_timer.Enabled = k
        If k = True And exiter1.Enabled = True Then
            Application.DoEvents() '                        GW        11/4/2011
        End If
        veh_exit.Enabled = l
        beam_made.Enabled = n
        Timer1.Enabled = o
        FROZEN = m

    End Function

    Sub test_proc()

        DebugInfo("*** Test Proc")

        On Error GoTo errorhandler

        Label1.Text = "Test Weighing"
        'UPGRADE_WARNING: Couldn't resolve default property of object to_driver(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        do_display = CType(to_driver("Test Weighing", ""), Short)
        WAIT_DOING = True
        Text1.Enabled = False
        Label5.Text = "Getting Weight"

        DebugInfo("*** Test Proc - Getting Weight")

        Do
            System.Windows.Forms.Application.DoEvents()
            GetW = GetWeight(ScaleRef, INBOUND_COMPORT, Weight)
        Loop Until GetW <> 0

        WAIT_DOING = False
        Label5.Text = ""

        DebugInfo("*** Test Proc - GetW = " & Str(GetW) & " ENQs = " & Str(GetW_ENQs))

        If GetW_ENQs > 0 Then
            'Mod Sep-06 - stored procedure returns formatted date/time
            'Procedure sGetSysTimeDate(pTime, pTimeDate)

            SqlCmd = "BEGIN BS_COMPk.sGetSysTimeDate(?,?); END;"
            DebugInfo("SQL " & SqlCmd)
            Dim drc As DataRow = Odbc_PopulateBlankParams(adoCn, SqlCmd, True)

            DebugInfo("SQL Returned")
            'Store result
            'the_time_date = qy.rdoParameters(1).Value.ToString()
            the_time_date = drc(1).ToString()

            GetW_Msg = "Timeout - " & Str(GetW_ENQs) & " ENQs sent to Avery"
            'PrintOWBTally(99999, 0, Weight, SerialNo, "99999999", "9999", the_time_date, "999999", GetW_Msg)
            PrintOWBTallyEx("Out WeighBridge", 99999, 0, Weight, SerialNo, "99999999", "9999", the_time_date, "999999", GetW_Msg, STATION_ID.ToString(), con_name)

            GetW_ENQs = 0

        End If

        If GetW = 2 Then
        Else
            Select Case GetW
                Case 1 'Scale Error
                    Label5.Text = "Cannot get Weight. Click Reset"
                    do_display = CType(to_driver("Cannot get Weight", ""), Short)
                Case 3 'Scale Unsteady
                    Label5.Text = "Avery Unsteady. Click Reset"
                    do_display = CType(to_driver("Avery Unsteady", ""), Short)
                Case 4 'Weighbridge has not seen zero
                    Label5.Text = "Weighbridge has not seen zero. Click Reset"
                    do_display = CType(to_driver("Weighbridge has not seen zero", ""), Short)
                Case Else 'Any other error
                    Label5.Text = "Weighbridge Error. Click Reset"
                    do_display = CType(to_driver("Weighbridge Error", ""), Short)
            End Select

            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, False, False, False, False, False)
            Exit Sub
        End If

        Label3(7).Text = Str(Weight)
        Label3(8).Text = Str(SerialNo)
        lightbeam_broke_timer.Enabled = False

        'Mod Sep-06 - use cn2 (Croplands) rather than cn (BIC)
        'cn2.BeginTrans
        'cn2.Execute "SAVEPOINT OUT_WB1"

        DebugInfo("*** Test Proc - Updating Database")

        'Mod Sep-06 - stored procedure returns formatted date/time
        'Procedure sGetSysTimeDate(pTime, pTimeDate)

        SqlCmd = "BEGIN BS_COMPk.sGetSysTimeDate(?,?); END;"
        DebugInfo("SQL " & SqlCmd)
        Dim dr As DataRow = Odbc_PopulateBlankParams(adoCn, SqlCmd, True)

        DebugInfo("SQL Returned")
        'Store result
        'the_time_date = qy.rdoParameters(1).Value.ToString()
        'the_time = qy.rdoParameters(0).Value.ToString()
        the_time_date = dr(1).ToString()
        the_time = dr(0).ToString()

        'Mod Sep-06 - stored procedure to do insert
        'Procedure SD_PROC_IWB_CAL_TEST_RESULT(STATION_CODE, TEST_DATE, FACTORY_CODE, WEIGHT, TALLY_ROLL)

        SqlCmd = "call SD_PROC_IWB_CAL_TEST_RESULT('" & STATION_ID.ToString() & "',SYSDATE,'" & FAC_NUM & "'," & Str(Weight) & "," & Str(SerialNo) & ")"
        DebugInfo("SQL " & SqlCmd)

        'cn2.Execute((SqlCmd))
        If Not Odbc_ExecuteNonQuery(adoCn, SqlCmd, False) Then
            DebugInfo("Stored proc execution failure!")
        End If
        DebugInfo("SQL Returned")

        'cn2.Execute "COMMIT"
        'cn2.RollbackTrans

lost_oracle:

        DebugInfo("*** Test Proc - Printing Tally Printer")

        'PrintOWBTally(0, 0, Weight, SerialNo, "99999999", "9999", the_time_date, "999999", "")
        PrintOWBTallyEx("*** Test Proc - Printing Tally Printer", 0, 0, Weight, SerialNo, "99999999", "9999", the_time_date, "999999", "", STATION_ID.ToString(), con_name)

        DebugInfo("*** Test Proc - Printing Beet Receipt")

        ZebraLoadReceipt(0, 0, Weight, SerialNo, "", "", "", "99999999", "9999", the_time_date, SYS_MESSAGE1, SYS_MESSAGE2, SYS_MESSAGE3, SYS_MESSAGE4, "999999", PC_IDENTITY.ToString(), in_station_id, STATION_ID.ToString())


        'UPGRADE_WARNING: Couldn't resolve default property of object to_driver(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        do_display = CType(to_driver("Exit Beam Unbroken", ""), Short)
        Label5.Text = "Exit Beam Unbroken"
        Timer1.Enabled = False
        remake_LBs.Enabled = False
        lightbeam_broke_timer.Enabled = False
        exiter1.Enabled = True
        stubcard_nr = "99999999"

        Exit Sub

errorhandler:

        Error_Msg = "ERROR " & Str(Err.Number) & ": " & Err.Description
        IWB_Function = "BIC Out Weighbridge 1"
        IWB_Sub_Function = "Test_Proc"

        response = do_error("X")

        'cn2.Execute "ROLLBACK TO SAVEPOINT OUT_WB1"
        'cn2.Execute "COMMIT"
        'cn2.RollbackTrans

        GoTo lost_oracle

    End Sub

    Sub cleanup()

        Label3(0).Text = ""
        Label3(7).Text = ""
        Label3(8).Text = ""
        Text1.Text = ""
        contract_nr = ""
        vehicle_nr = ""
        stubcard_nr = ""
        con_factory = ""
        con_name = ""
        haulier_code = ""
        atd_week = ""
        atd_day = ""
        atd_left = ""
        road_reg = ""
        fname = ""
        in_wt = 0
        in_wt_serial_nr = 0
        in_time = ""
        in_station_id = ""
        STUB_GIVEN = False

    End Sub

    Sub updates()

        'provision in here for doing stuff to the buffer if there
        'is a problem writing to the Oracle on error stuff for it

        'set up variables in global variable wback
        'for call to update3 in GLOBALS.BAS
        'UPGRADE_NOTE: Erase was upgraded to System.Array.Clear. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
        System.Array.Clear(wback, 0, wback.Length)
        wback(1) = Str(Weight)
        wback(2) = Str(SerialNo)
        wback(3) = STATION_ID.ToString()
        wback(4) = FAC_NUM
        wback(5) = vehicle_nr
        wback(6) = stubcard_nr

        update3()

        the_time_date = wback(17)

        Exit Sub

    End Sub

#Region "Timer_Tick Events"

    Private Sub entry_illegal_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles entry_illegal.Tick

        If DIGIO_Input(BEAM_ENTRY) = 1 Then
            DebugInfo("*** entry_illegal_Timer - Illegal Entry")

            State = INIT
            ILL_ENTRY = True
            Label1.Text = "Illegal Entry"
            'UPGRADE_WARNING: Couldn't resolve default property of object to_driver(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            do_display = CType(to_driver("Illegal Entry", ""), Short)
            DIGIO_Output((ALARM_ON))
            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, False, False, False, False, False)
        End If

    End Sub

    Private Sub exiter1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles exiter1.Tick

        REM                debug code for flashing...............
        If lightbeam_broke_timer.Enabled = True Then
            Application.DoEvents()
        End If
        REM                debug code for flashing...............
        If BeamsClearOWB() = BEAM_EXIT_BROKEN Then
            DebugInfo("*** exiter1_Timer - Awaiting Exit")

            Label1.Text = ""
            Label5.Text = "Vehicle Exiting Weighbridge"
            'do_display = CType(to_driver("Awaiting Exit", ""), Short)
            do_display = to_driver(DrvMsgs.VEHICLE_EXIT)
            exiter1.Enabled = False
            exiter2.Enabled = True
        End If

    End Sub

    Private Sub beam_made_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles beam_made.Tick

        If BeamsClearOWB() = BEAM_CLEAR Then
            DebugInfo("*** beam_made_timer - Stripe VIC")

            Label1.Text = "Enter Vehicle Number"
            Label5.Text = "Use Keyboard or Stripe VIC Card"
            'do_display = CType(to_driver("Stripe VIC", "                   "), Short)
            do_display = to_driver(DrvMsgs.VIC_STRIPE)
            STATES = state_trans(True, True, True, True, False, False, True, False, False, False, True, False, False, False, False)
        End If

    End Sub

    Private Sub exiter2_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles exiter2.Tick

        If BeamsClearOWB() <> BEAM_EXIT_BROKEN Then
            DebugInfo("*** exiter2_Timer - Transaction Complete - Awaiting Vehicle")

            tmpstr = ""
            If contract_nr = "" Then
                tmpstr = "Vehicle " & vehicle_nr & ", " & stubcard_nr & ", " & Str(Weight) & "Kg"
            Else
                tmpstr = "Vehicle " & vehicle_nr & ", " & stubcard_nr & ", " & contract_nr & " " & con_name & ", " & Str(Weight) & "Kg"
            End If

            cleanup()

            Label6.Text = tmpstr
            Label6.Visible = True
            Label5.Text = "Transaction Complete"
            exiter2.Enabled = False
            'Mod Aug-10 - remove control of traffic lights
            'DIGIO_Output (LIGHT_RED)
            'Label10.BackColor = &H80FF&
            indloop.Enabled = True
            Label1.Text = "Awaiting Vehicle"

            ' 08-Nov-2010 Trevor Mills
            ' Commented out the opening of the drivers display as the new
            ' IWB PCs do not have a serial card, and the display is being
            ' replaced by a second monitor
            'If MSComm_Term.PortOpen = True Then
            '   MSComm_Term.PortOpen = False
            'End If

            'MSComm_Term.CommPort = 7
            'MSComm_Term.PortOpen = True
            'do_display = CType(to_driver("Awaiting Vehicle at", "Bridge Entrance"), Short)
            do_display = to_driver(DrvMsgs.VEHICLE_ENTRY)
            STATES = state_trans(True, False, True, False, False, True, False, True, True, False, False, False, False, False, False)
            ILL_ENTRY = False
            DIGIO_Output((ALARM_OFF))
        End If

    End Sub

    ' AES 05/05/05
    ' Timer to wait for digital signal from Access Control Door Controller
    Private Sub External_Devices_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles External_Devices.Tick

        If DIGIO_Input(BEAM_ENTRY) = 0 Then
            Label13.BackColor = System.Drawing.ColorTranslator.FromOle(&HC000)
        Else
            Label13.BackColor = System.Drawing.ColorTranslator.FromOle(&HFF)
        End If

        If DIGIO_Input(BEAM_EXIT) = 0 Then
            Label14.BackColor = System.Drawing.ColorTranslator.FromOle(&HC000)
        Else
            Label14.BackColor = System.Drawing.ColorTranslator.FromOle(&HFF)
        End If

        'Mod Aug-10 - induction loop removed
        'If DIGIO_Input(INDLOOP_ENTRY) = 0 Then
        '   Label8.BackColor = &HC000&
        'Else
        '   Label8.BackColor = &HFF&
        'End If

        If OWB_AccessCtrl = True Then ' AES 09/08/05 Access control initiated ?

            If DIGIO_Input(ACCESS_DC) = 0 Then ' AES 05/05/05 Add access control DC input status
                Label16.BackColor = System.Drawing.ColorTranslator.FromOle(&HC000)
            Else
                Label16.BackColor = System.Drawing.ColorTranslator.FromOle(&HFF)
            End If
        End If
    End Sub

    Private Sub indloop_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles indloop.Tick

        'Mod Aug-10
        'This originally ran to check the induction loop for a vehicle, then
        'balance the Avery and then go to the stage of waiting for the entry
        'light beam to be broken.
        '
        'Since the Avery balancing is now done externally, we will jump straight
        'to the point of waiting for the entry light beam to be broken

        Label5.Text = "Entry Beam Unbroken"
        Label1.Text = "Awaiting Vehicle"
        'do_display = CType(to_driver("Entry Beam Unbroken", ""), Short)

        do_display = to_driver(DrvMsgs.VEHICLE_ENTRY)
        STATES = state_trans(True, True, True, False, False, True, False, False, False, True, False, False, False, False, False)
        GetW = 0


    End Sub

    Private Sub AccessDCTimer_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles AccessDCTimer.Tick

        If OWB_AccessCtrl = False Then ' AES 09/08/05 Access control initiated ?
            '                  not any more ..........         GW                    12/4/2011                Exit Sub ' NO! Exit
        End If

        If ACCEPT_BTN = True Then ' Accept signal enabled ?
            REM                                GW                12/4/2011                             If DIGIO_Input(ACCESS_DC) = 1 Then ' Signal seen at door controller ?
            If DIGIO_Input(ACCESS_DC) = 1 Or DIGIO_Input(BUTTON_PRESS) = 1 Then ' Signal seen at door controller ?
                DebugInfo("*** AccessDCTimer - Door controller signal received")

                ACCEPT_BTN = False ' Disable signal detection
                Command2(0).Enabled = False ' Disabled 'Accept' button
                AccessDCTimer.Enabled = False ' Disable Access DC signal

                'do_display = CType(to_driver("Exit Beam Unbroken", ""), Short) ' Display drivers message
                REM                GW        7/4/2011
                If OWB_AccessCtrl = False Then
                    do_display = to_driver(DrvMsgs.VEHICLE_EXIT)
                    Label5.Text = "Waiting for vehicle to leave" '                 GW           18/4/2011
                    PrintStoredZebra()
                Else
                    REM                GW                 7/4/2011                 do_display = to_driver("Thank You", DrvMsgs.TAKE_LOAD_RECEIPT)
                    do_display = to_driver("", "", "Thank You" & vbCrLf & vbCrLf & DrvMsgs.TAKE_LOAD_RECEIPT, "")
                    Label5.Text = "Waiting for vehicle to leave" '                 GW           18/4/2011
                    PrintStoredZebra()
                End If

                REM               GW                        7/4/2011
                If OWB_AccessCtrl = False Then
                    REM                                        GW          18/4/2011                 last_proc() ' Continue processing
                End If
                REM               GW                        7/4/2011
                Exit Sub
            End If
        End If

    End Sub

    Private Sub lightbeam_broke_timer_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lightbeam_broke_timer.Tick
        Dim BCOWB As Short
        BCOWB = BeamsClearOWB()

        If BeamsClearOWB() <> BEAM_CLEAR Then
            DebugInfo("*** lightbeam_broke_Timer - Illegal Positioning")

            State = INIT
            ILL_ENTRY = True
            Label1.Text = "Illegal Positioning"

            If BeamsClearOWB() = BEAM_ENTRY_BROKEN Then
                do_display = to_driver(DrvMsgs.ENTRY_BEAM_SEVERED)
                Label5.Text = "Weighbridge Entry Beam Broken"
            End If

            If BeamsClearOWB() = BEAM_EXIT_BROKEN Then
                do_display = to_driver(DrvMsgs.EXIT_BEAM_SEVERED)
                Label5.Text = "Weighbridge Exit Beam Broken"
            End If

            Illegal_Positioning = True
            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, True, False, False, False, True)

            If STUB_GIVEN = True Then
                remake_LBs.Enabled = True
                Timer1.Enabled = False
            Else
                remake_LBs.Enabled = False
                Timer1.Enabled = True
            End If
        End If

    End Sub

    Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick

        If BeamsClearOWB() = BEAM_CLEAR Then
            DebugInfo("*** Timer1_Timer - Telling Driver to stripe VIC")

            ILL_ENTRY = False
            Label1.Text = "Enter Vehicle Number"
            Label5.Text = "Use Keyboard or Stripe VIC Card"
            'Label5.Caption = "Use Keyboard or Stripe VIC Card"
            'do_display = CType(to_driver("Stripe VIC", "                   "), Short)
            do_display = to_driver(DrvMsgs.VIC_STRIPE)
            STATES = state_trans(True, True, True, True, False, False, True, False, False, False, True, False, False, False, False)
            Timer1.Enabled = False
            lightbeam_broke_timer.Enabled = True
        End If

    End Sub

    Private Sub remake_LBs_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles remake_LBs.Tick

        If BeamsClearOWB() = BEAM_CLEAR Then
            DebugInfo("*** remake_LBs_Timer - Light Beams Made")

            ILL_ENTRY = False
            If Mid(stubcard_nr, 3, 4) = "9999" Then
                Label1.Text = "Test Weighing"
            Else
                Label1.Text = "Vehicle In Position"
            End If

            If ACCEPT_BTN = True Then
                Command2(0).Enabled = True
            End If

            remake_LBs.Enabled = False
            lightbeam_broke_timer.Enabled = True
        End If

    End Sub

    Private Sub veh_enters_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles veh_enters.Tick

        If DIGIO_Input(BEAM_ENTRY) = 1 Then
            DebugInfo("*** veh_enters_Timer - Position Vehicle")

            'Mod Aug-10 - remove control of traffic lights
            'DIGIO_Output (LIGHT_RED)
            'Label10.BackColor = &H80FF&
            Label1.Text = "Position Vehicle"
            'do_display = CType(to_driver("Position Vehicle", ""), Short)

            do_display = to_driver(DrvMsgs.POSITION_VEHICLE)
            Label5.Text = ""
            STATES = state_trans(True, True, True, False, False, False, False, False, False, False, False, False, False, True, False)
        End If

    End Sub

#End Region

    Private Sub Label14_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label14.BackColorChanged
        Application.DoEvents()
    End Sub

    Private Sub Label14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label14.Click

    End Sub
End Class

Open in new window

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Partial Class out_wb4
#Region "Windows Form Designer generated code "
	<System.Diagnostics.DebuggerNonUserCode()> Public Sub New()
		MyBase.New()
		'This call is required by the Windows Form Designer.
		InitializeComponent()
	End Sub
	'Form overrides dispose to clean up the component list.
	<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents MSComm_Term As AxMSCommLib.AxMSComm
	Public WithEvents Timer1 As System.Windows.Forms.Timer
	Public WithEvents Text2 As System.Windows.Forms.TextBox
	Public WithEvents Command9 As System.Windows.Forms.Button
	Public WithEvents Command8 As System.Windows.Forms.Button
	Public WithEvents Command6 As System.Windows.Forms.Button
	Public WithEvents Command2 As System.Windows.Forms.Button
	Public WithEvents Command3 As System.Windows.Forms.Button
	Public WithEvents Command4 As System.Windows.Forms.Button
	Public WithEvents Text1 As System.Windows.Forms.TextBox
	Public WithEvents Label13 As System.Windows.Forms.Label
	Public WithEvents Label9 As System.Windows.Forms.Label
	Public WithEvents Label10 As System.Windows.Forms.Label
	Public WithEvents Label11 As System.Windows.Forms.Label
	Public WithEvents Label6 As System.Windows.Forms.Label
	Public WithEvents Label4 As System.Windows.Forms.Label
	Public WithEvents Label3 As System.Windows.Forms.Label
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Label5 As System.Windows.Forms.Label
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents Command5 As System.Windows.Forms.Button
	Public WithEvents MSComm_Scale As AxMSCommLib.AxMSComm
	Public WithEvents MSComm_Print As AxMSCommLib.AxMSComm
	Public WithEvents Label12 As System.Windows.Forms.Label
	Public WithEvents Label2 As System.Windows.Forms.Label
	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.
	'Do not modify it using the code editor.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(out_wb4))
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.MSComm_Term = New AxMSCommLib.AxMSComm
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.Frame1 = New System.Windows.Forms.GroupBox
        Me.Text2 = New System.Windows.Forms.TextBox
        Me.Command9 = New System.Windows.Forms.Button
        Me.Command8 = New System.Windows.Forms.Button
        Me.Command6 = New System.Windows.Forms.Button
        Me.Command2 = New System.Windows.Forms.Button
        Me.Command3 = New System.Windows.Forms.Button
        Me.Command4 = New System.Windows.Forms.Button
        Me.Text1 = New System.Windows.Forms.TextBox
        Me.Label13 = New System.Windows.Forms.Label
        Me.Label9 = New System.Windows.Forms.Label
        Me.Label10 = New System.Windows.Forms.Label
        Me.Label11 = New System.Windows.Forms.Label
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.Command5 = New System.Windows.Forms.Button
        Me.MSComm_Scale = New AxMSCommLib.AxMSComm
        Me.MSComm_Print = New AxMSCommLib.AxMSComm
        Me.Label12 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        CType(Me.MSComm_Term, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.Frame1.SuspendLayout()
        CType(Me.MSComm_Scale, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.MSComm_Print, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'MSComm_Term
        '
        Me.MSComm_Term.Enabled = True
        Me.MSComm_Term.Location = New System.Drawing.Point(152, 16)
        Me.MSComm_Term.Name = "MSComm_Term"
        Me.MSComm_Term.OcxState = CType(resources.GetObject("MSComm_Term.OcxState"), System.Windows.Forms.AxHost.State)
        Me.MSComm_Term.Size = New System.Drawing.Size(38, 38)
        Me.MSComm_Term.TabIndex = 0
        '
        'Timer1
        '
        Me.Timer1.Enabled = True
        Me.Timer1.Interval = 300
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.Frame1.Controls.Add(Me.Text2)
        Me.Frame1.Controls.Add(Me.Command9)
        Me.Frame1.Controls.Add(Me.Command8)
        Me.Frame1.Controls.Add(Me.Command6)
        Me.Frame1.Controls.Add(Me.Command2)
        Me.Frame1.Controls.Add(Me.Command3)
        Me.Frame1.Controls.Add(Me.Command4)
        Me.Frame1.Controls.Add(Me.Text1)
        Me.Frame1.Controls.Add(Me.Label13)
        Me.Frame1.Controls.Add(Me.Label9)
        Me.Frame1.Controls.Add(Me.Label10)
        Me.Frame1.Controls.Add(Me.Label11)
        Me.Frame1.Controls.Add(Me.Label6)
        Me.Frame1.Controls.Add(Me.Label4)
        Me.Frame1.Controls.Add(Me.Label3)
        Me.Frame1.Controls.Add(Me.Label1)
        Me.Frame1.Controls.Add(Me.Label5)
        Me.Frame1.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame1.ForeColor = System.Drawing.Color.Yellow
        Me.Frame1.Location = New System.Drawing.Point(32, 72)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.Padding = New System.Windows.Forms.Padding(0)
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(657, 385)
        Me.Frame1.TabIndex = 0
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Test Options"
        '
        'Text2
        '
        Me.Text2.AcceptsReturn = True
        Me.Text2.BackColor = System.Drawing.SystemColors.InactiveBorder
        Me.Text2.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Text2.Enabled = False
        Me.Text2.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Text2.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Text2.Location = New System.Drawing.Point(248, 40)
        Me.Text2.MaxLength = 20
        Me.Text2.Name = "Text2"
        Me.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Text2.Size = New System.Drawing.Size(161, 25)
        Me.Text2.TabIndex = 16
        '
        'Command9
        '
        Me.Command9.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command9.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command9.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command9.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command9.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command9.Location = New System.Drawing.Point(440, 202)
        Me.Command9.Name = "Command9"
        Me.Command9.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command9.Size = New System.Drawing.Size(185, 33)
        Me.Command9.TabIndex = 7
        Me.Command9.Text = "Start Alarm"
        Me.Command9.UseVisualStyleBackColor = False
        Me.Command9.Visible = False
        '
        'Command8
        '
        Me.Command8.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command8.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command8.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command8.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command8.Location = New System.Drawing.Point(16, 40)
        Me.Command8.Name = "Command8"
        Me.Command8.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command8.Size = New System.Drawing.Size(201, 33)
        Me.Command8.TabIndex = 2
        Me.Command8.Text = "Driver Display Test"
        Me.Command8.UseVisualStyleBackColor = False
        '
        'Command6
        '
        Me.Command6.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command6.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command6.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command6.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command6.Location = New System.Drawing.Point(440, 96)
        Me.Command6.Name = "Command6"
        Me.Command6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command6.Size = New System.Drawing.Size(185, 33)
        Me.Command6.TabIndex = 6
        Me.Command6.Text = "Zebra Printer Test Print"
        Me.Command6.UseVisualStyleBackColor = False
        '
        'Command2
        '
        Me.Command2.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command2.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command2.Location = New System.Drawing.Point(16, 96)
        Me.Command2.Name = "Command2"
        Me.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command2.Size = New System.Drawing.Size(201, 33)
        Me.Command2.TabIndex = 3
        Me.Command2.Text = "Test Barcode Reader"
        Me.Command2.UseVisualStyleBackColor = False
        '
        'Command3
        '
        Me.Command3.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command3.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command3.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command3.Location = New System.Drawing.Point(440, 40)
        Me.Command3.Name = "Command3"
        Me.Command3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command3.Size = New System.Drawing.Size(185, 33)
        Me.Command3.TabIndex = 5
        Me.Command3.Text = "Tally Printer Test Print"
        Me.Command3.UseVisualStyleBackColor = False
        Me.Command3.Visible = False
        '
        'Command4
        '
        Me.Command4.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
        Me.Command4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command4.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command4.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command4.Location = New System.Drawing.Point(16, 152)
        Me.Command4.Name = "Command4"
        Me.Command4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command4.Size = New System.Drawing.Size(201, 33)
        Me.Command4.TabIndex = 4
        Me.Command4.Text = "Avery 1310 Test"
        Me.Command4.UseVisualStyleBackColor = False
        '
        'Text1
        '
        Me.Text1.AcceptsReturn = True
        Me.Text1.BackColor = System.Drawing.SystemColors.InactiveBorder
        Me.Text1.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Text1.Enabled = False
        Me.Text1.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Text1.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Text1.Location = New System.Drawing.Point(248, 96)
        Me.Text1.MaxLength = 0
        Me.Text1.Name = "Text1"
        Me.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Text1.Size = New System.Drawing.Size(161, 25)
        Me.Text1.TabIndex = 8
        '
        'Label13
        '
        Me.Label13.BackColor = System.Drawing.SystemColors.Control
        Me.Label13.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label13.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label13.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label13.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label13.Location = New System.Drawing.Point(248, 320)
        Me.Label13.Name = "Label13"
        Me.Label13.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label13.Size = New System.Drawing.Size(161, 33)
        Me.Label13.TabIndex = 20
        Me.Label13.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label9
        '
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label9.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label9.ForeColor = System.Drawing.Color.Green
        Me.Label9.Location = New System.Drawing.Point(16, 328)
        Me.Label9.Name = "Label9"
        Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label9.Size = New System.Drawing.Size(201, 33)
        Me.Label9.TabIndex = 19
        Me.Label9.Text = "Access Control DC Status"
        '
        'Label10
        '
        Me.Label10.BackColor = System.Drawing.Color.Transparent
        Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label10.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label10.ForeColor = System.Drawing.Color.Green
        Me.Label10.Location = New System.Drawing.Point(437, 287)
        Me.Label10.Name = "Label10"
        Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label10.Size = New System.Drawing.Size(113, 18)
        Me.Label10.TabIndex = 18
        Me.Label10.Text = "Accept Button"
        '
        'Label11
        '
        Me.Label11.BackColor = System.Drawing.SystemColors.Control
        Me.Label11.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label11.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label11.Location = New System.Drawing.Point(440, 320)
        Me.Label11.Name = "Label11"
        Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label11.Size = New System.Drawing.Size(98, 33)
        Me.Label11.TabIndex = 15
        Me.Label11.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label6
        '
        Me.Label6.BackColor = System.Drawing.SystemColors.Control
        Me.Label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label6.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label6.Location = New System.Drawing.Point(248, 264)
        Me.Label6.Name = "Label6"
        Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label6.Size = New System.Drawing.Size(161, 33)
        Me.Label6.TabIndex = 14
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.Color.Transparent
        Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label4.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.ForeColor = System.Drawing.Color.Green
        Me.Label4.Location = New System.Drawing.Point(16, 272)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(201, 33)
        Me.Label4.TabIndex = 13
        Me.Label4.Text = "Exit Light Beam Status"
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label3.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.ForeColor = System.Drawing.Color.Green
        Me.Label3.Location = New System.Drawing.Point(16, 216)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(201, 33)
        Me.Label3.TabIndex = 12
        Me.Label3.Text = "Entry Light Beam Status"
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(248, 208)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(161, 33)
        Me.Label1.TabIndex = 10
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label5
        '
        Me.Label5.BackColor = System.Drawing.SystemColors.Control
        Me.Label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label5.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label5.Location = New System.Drawing.Point(248, 152)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(161, 33)
        Me.Label5.TabIndex = 9
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Command5
        '
        Me.Command5.BackColor = System.Drawing.SystemColors.Control
        Me.Command5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command5.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Command5.Font = New System.Drawing.Font("Arial", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Command5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command5.Location = New System.Drawing.Point(32, 536)
        Me.Command5.Name = "Command5"
        Me.Command5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command5.Size = New System.Drawing.Size(217, 33)
        Me.Command5.TabIndex = 1
        Me.Command5.Text = "Return To Previous Menu"
        Me.Command5.UseVisualStyleBackColor = False
        '
        'MSComm_Scale
        '
        Me.MSComm_Scale.Enabled = True
        Me.MSComm_Scale.Location = New System.Drawing.Point(8, 16)
        Me.MSComm_Scale.Name = "MSComm_Scale"
        Me.MSComm_Scale.OcxState = CType(resources.GetObject("MSComm_Scale.OcxState"), System.Windows.Forms.AxHost.State)
        Me.MSComm_Scale.Size = New System.Drawing.Size(38, 38)
        Me.MSComm_Scale.TabIndex = 2
        '
        'MSComm_Print
        '
        Me.MSComm_Print.Enabled = True
        Me.MSComm_Print.Location = New System.Drawing.Point(208, 24)
        Me.MSComm_Print.Name = "MSComm_Print"
        Me.MSComm_Print.OcxState = CType(resources.GetObject("MSComm_Print.OcxState"), System.Windows.Forms.AxHost.State)
        Me.MSComm_Print.Size = New System.Drawing.Size(38, 38)
        Me.MSComm_Print.TabIndex = 3
        '
        'Label12
        '
        Me.Label12.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.Label12.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label12.Font = New System.Drawing.Font("Arial", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label12.ForeColor = System.Drawing.Color.Yellow
        Me.Label12.Location = New System.Drawing.Point(528, 536)
        Me.Label12.Name = "Label12"
        Me.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label12.Size = New System.Drawing.Size(161, 49)
        Me.Label12.TabIndex = 17
        Me.Label12.Text = "Please Select by Clicking Your Choice or Use the TAB and ENTER keys. "
        Me.Label12.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label2
        '
        Me.Label2.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label2.Font = New System.Drawing.Font("Arial", 28.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.ForeColor = System.Drawing.SystemColors.HighlightText
        Me.Label2.Location = New System.Drawing.Point(24, 5)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(738, 49)
        Me.Label2.TabIndex = 11
        Me.Label2.Text = "Out Weighbridge - Test Devices"
        '
        'out_wb4
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.ClientSize = New System.Drawing.Size(800, 593)
        Me.Controls.Add(Me.MSComm_Term)
        Me.Controls.Add(Me.Frame1)
        Me.Controls.Add(Me.Command5)
        Me.Controls.Add(Me.MSComm_Scale)
        Me.Controls.Add(Me.MSComm_Print)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.Label2)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.Location = New System.Drawing.Point(90, 78)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "out_wb4"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Text = "Out Weighbridge - Test Devices"
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        CType(Me.MSComm_Term, System.ComponentModel.ISupportInitialize).EndInit()
        Me.Frame1.ResumeLayout(False)
        Me.Frame1.PerformLayout()
        CType(Me.MSComm_Scale, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.MSComm_Print, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region 
End Class

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SimonPrice33
SimonPrice33

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
answer no longer required. solution found elsewhere