Option Strict Off
Option Explicit On 
Imports System.Text

Friend Class Form1
    Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        If m_vb6FormDefInstance Is Nothing Then
            If m_InitializingDefInstance Then
                m_vb6FormDefInstance = Me
            Else
                Try
                    'For the start-up form, the first instance created is the default instance.
                    If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
                        m_vb6FormDefInstance = Me
                    End If
                Catch
                End Try
            End If
        End If
        'This call is required by the Windows Form Designer.
        InitializeComponent()
    End Sub
    'Form overrides dispose to clean up the component list.
    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 Button_Exit As System.Windows.Forms.Button
    Public WithEvents Button_DioExit As System.Windows.Forms.Button
    Public WithEvents Edit_ReturnCode As System.Windows.Forms.TextBox
    Public WithEvents Edit_OutBitData As System.Windows.Forms.TextBox
    Public WithEvents Edit_OutBitNo As System.Windows.Forms.TextBox
    Public WithEvents Button_EchoBackBit As System.Windows.Forms.Button
    Public WithEvents Button_OutBit As System.Windows.Forms.Button
    Public WithEvents Label11 As System.Windows.Forms.Label
    Public WithEvents Label8 As System.Windows.Forms.Label
    Public WithEvents Frame4 As System.Windows.Forms.GroupBox
    Public WithEvents Edit_OutPortData As System.Windows.Forms.TextBox
    Public WithEvents Edit_OutPortNo As System.Windows.Forms.TextBox
    Public WithEvents Button_EchoBackByte As System.Windows.Forms.Button
    Public WithEvents Button_OutByte As System.Windows.Forms.Button
    Public WithEvents Label12 As System.Windows.Forms.Label
    Public WithEvents Label10 As System.Windows.Forms.Label
    Public WithEvents Label7 As System.Windows.Forms.Label
    Public WithEvents Frame3 As System.Windows.Forms.GroupBox
    Public WithEvents Edit_InpBitData As System.Windows.Forms.TextBox
    Public WithEvents Edit_InpBitNo As System.Windows.Forms.TextBox
    Public WithEvents Button_InpBit As System.Windows.Forms.Button
    Public WithEvents Label9 As System.Windows.Forms.Label
    Public WithEvents Label6 As System.Windows.Forms.Label
    Public WithEvents Frame2 As System.Windows.Forms.GroupBox
    Public WithEvents Button_InpByte As System.Windows.Forms.Button
    Public WithEvents Edit_InpPortData As System.Windows.Forms.TextBox
    Public WithEvents Edit_InpPortNo As System.Windows.Forms.TextBox
    Public WithEvents Label4 As System.Windows.Forms.Label
    Public WithEvents Label3 As System.Windows.Forms.Label
    Public WithEvents Label2 As System.Windows.Forms.Label
    Public WithEvents Frame1 As System.Windows.Forms.GroupBox
    Public WithEvents Button_DioInit As System.Windows.Forms.Button
    Public WithEvents Edit_DeviceName As System.Windows.Forms.TextBox
    Public WithEvents Label5 As System.Windows.Forms.Label
    Public WithEvents Label1 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.
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Public WithEvents Label13 As System.Windows.Forms.Label
    Public WithEvents Edit_DirData As System.Windows.Forms.TextBox
    Public WithEvents Button_SetIoDirection As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.Button_Exit = New System.Windows.Forms.Button()
        Me.Button_DioExit = New System.Windows.Forms.Button()
        Me.Edit_ReturnCode = New System.Windows.Forms.TextBox()
        Me.Frame4 = New System.Windows.Forms.GroupBox()
        Me.Edit_OutBitData = New System.Windows.Forms.TextBox()
        Me.Edit_OutBitNo = New System.Windows.Forms.TextBox()
        Me.Button_EchoBackBit = New System.Windows.Forms.Button()
        Me.Button_OutBit = New System.Windows.Forms.Button()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.Frame3 = New System.Windows.Forms.GroupBox()
        Me.Edit_OutPortData = New System.Windows.Forms.TextBox()
        Me.Edit_OutPortNo = New System.Windows.Forms.TextBox()
        Me.Button_EchoBackByte = New System.Windows.Forms.Button()
        Me.Button_OutByte = New System.Windows.Forms.Button()
        Me.Label12 = New System.Windows.Forms.Label()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.Frame2 = New System.Windows.Forms.GroupBox()
        Me.Edit_InpBitData = New System.Windows.Forms.TextBox()
        Me.Edit_InpBitNo = New System.Windows.Forms.TextBox()
        Me.Button_InpBit = New System.Windows.Forms.Button()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Frame1 = New System.Windows.Forms.GroupBox()
        Me.Button_InpByte = New System.Windows.Forms.Button()
        Me.Edit_InpPortData = New System.Windows.Forms.TextBox()
        Me.Edit_InpPortNo = New System.Windows.Forms.TextBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Button_DioInit = New System.Windows.Forms.Button()
        Me.Edit_DeviceName = New System.Windows.Forms.TextBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.Button_SetIoDirection = New System.Windows.Forms.Button()
        Me.Edit_DirData = New System.Windows.Forms.TextBox()
        Me.Label13 = New System.Windows.Forms.Label()
        Me.Frame4.SuspendLayout()
        Me.Frame3.SuspendLayout()
        Me.Frame2.SuspendLayout()
        Me.Frame1.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Button_Exit
        '
        Me.Button_Exit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_Exit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_Exit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_Exit.Location = New System.Drawing.Point(328, 384)
        Me.Button_Exit.Name = "Button_Exit"
        Me.Button_Exit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_Exit.Size = New System.Drawing.Size(104, 25)
        Me.Button_Exit.TabIndex = 19
        Me.Button_Exit.Text = "Exit"
        '
        'Button_DioExit
        '
        Me.Button_DioExit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_DioExit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_DioExit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_DioExit.Location = New System.Drawing.Point(328, 344)
        Me.Button_DioExit.Name = "Button_DioExit"
        Me.Button_DioExit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_DioExit.Size = New System.Drawing.Size(104, 25)
        Me.Button_DioExit.TabIndex = 18
        Me.Button_DioExit.Text = "DioExit"
        '
        'Edit_ReturnCode
        '
        Me.Edit_ReturnCode.AcceptsReturn = True
        Me.Edit_ReturnCode.AutoSize = False
        Me.Edit_ReturnCode.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_ReturnCode.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_ReturnCode.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_ReturnCode.Location = New System.Drawing.Point(104, 344)
        Me.Edit_ReturnCode.MaxLength = 0
        Me.Edit_ReturnCode.Name = "Edit_ReturnCode"
        Me.Edit_ReturnCode.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_ReturnCode.Size = New System.Drawing.Size(209, 25)
        Me.Edit_ReturnCode.TabIndex = 13
        Me.Edit_ReturnCode.Text = "Text4"
        '
        'Frame4
        '
        Me.Frame4.BackColor = System.Drawing.SystemColors.Control
        Me.Frame4.Controls.AddRange(New System.Windows.Forms.Control() {Me.Edit_OutBitData, Me.Edit_OutBitNo, Me.Button_EchoBackBit, Me.Button_OutBit, Me.Label11, Me.Label8})
        Me.Frame4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame4.Location = New System.Drawing.Point(8, 280)
        Me.Frame4.Name = "Frame4"
        Me.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame4.Size = New System.Drawing.Size(569, 49)
        Me.Frame4.TabIndex = 12
        Me.Frame4.TabStop = False
        Me.Frame4.Text = "1 Bit Output"
        '
        'Edit_OutBitData
        '
        Me.Edit_OutBitData.AcceptsReturn = True
        Me.Edit_OutBitData.AutoSize = False
        Me.Edit_OutBitData.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_OutBitData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_OutBitData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_OutBitData.Location = New System.Drawing.Point(232, 24)
        Me.Edit_OutBitData.MaxLength = 0
        Me.Edit_OutBitData.Name = "Edit_OutBitData"
        Me.Edit_OutBitData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_OutBitData.Size = New System.Drawing.Size(33, 18)
        Me.Edit_OutBitData.TabIndex = 27
        Me.Edit_OutBitData.Text = "Text6"
        '
        'Edit_OutBitNo
        '
        Me.Edit_OutBitNo.AcceptsReturn = True
        Me.Edit_OutBitNo.AutoSize = False
        Me.Edit_OutBitNo.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_OutBitNo.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_OutBitNo.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_OutBitNo.Location = New System.Drawing.Point(104, 24)
        Me.Edit_OutBitNo.MaxLength = 0
        Me.Edit_OutBitNo.Name = "Edit_OutBitNo"
        Me.Edit_OutBitNo.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_OutBitNo.Size = New System.Drawing.Size(49, 18)
        Me.Edit_OutBitNo.TabIndex = 26
        Me.Edit_OutBitNo.Text = "Text5"
        '
        'Button_EchoBackBit
        '
        Me.Button_EchoBackBit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_EchoBackBit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_EchoBackBit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_EchoBackBit.Location = New System.Drawing.Point(440, 16)
        Me.Button_EchoBackBit.Name = "Button_EchoBackBit"
        Me.Button_EchoBackBit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_EchoBackBit.Size = New System.Drawing.Size(112, 25)
        Me.Button_EchoBackBit.TabIndex = 21
        Me.Button_EchoBackBit.Text = "DioEchoBackBit"
        '
        'Button_OutBit
        '
        Me.Button_OutBit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_OutBit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_OutBit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_OutBit.Location = New System.Drawing.Point(320, 16)
        Me.Button_OutBit.Name = "Button_OutBit"
        Me.Button_OutBit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_OutBit.Size = New System.Drawing.Size(104, 25)
        Me.Button_OutBit.TabIndex = 17
        Me.Button_OutBit.Text = "DioOutBit"
        '
        'Label11
        '
        Me.Label11.BackColor = System.Drawing.SystemColors.Control
        Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label11.Location = New System.Drawing.Point(160, 24)
        Me.Label11.Name = "Label11"
        Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label11.Size = New System.Drawing.Size(69, 17)
        Me.Label11.TabIndex = 33
        Me.Label11.Text = "Output Data:"
        '
        'Label8
        '
        Me.Label8.BackColor = System.Drawing.SystemColors.Control
        Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label8.Location = New System.Drawing.Point(16, 24)
        Me.Label8.Name = "Label8"
        Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label8.Size = New System.Drawing.Size(89, 17)
        Me.Label8.TabIndex = 30
        Me.Label8.Text = "Logic BitNo:"
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.SystemColors.Control
        Me.Frame3.Controls.AddRange(New System.Windows.Forms.Control() {Me.Edit_OutPortData, Me.Edit_OutPortNo, Me.Button_EchoBackByte, Me.Button_OutByte, Me.Label12, Me.Label10, Me.Label7})
        Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame3.Location = New System.Drawing.Point(8, 224)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(569, 49)
        Me.Frame3.TabIndex = 11
        Me.Frame3.TabStop = False
        Me.Frame3.Text = "1 Port Output"
        '
        'Edit_OutPortData
        '
        Me.Edit_OutPortData.AcceptsReturn = True
        Me.Edit_OutPortData.AutoSize = False
        Me.Edit_OutPortData.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_OutPortData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_OutPortData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_OutPortData.Location = New System.Drawing.Point(232, 24)
        Me.Edit_OutPortData.MaxLength = 0
        Me.Edit_OutPortData.Name = "Edit_OutPortData"
        Me.Edit_OutPortData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_OutPortData.Size = New System.Drawing.Size(33, 18)
        Me.Edit_OutPortData.TabIndex = 25
        Me.Edit_OutPortData.Text = "Text4"
        '
        'Edit_OutPortNo
        '
        Me.Edit_OutPortNo.AcceptsReturn = True
        Me.Edit_OutPortNo.AutoSize = False
        Me.Edit_OutPortNo.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_OutPortNo.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_OutPortNo.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_OutPortNo.Location = New System.Drawing.Point(104, 24)
        Me.Edit_OutPortNo.MaxLength = 0
        Me.Edit_OutPortNo.Name = "Edit_OutPortNo"
        Me.Edit_OutPortNo.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_OutPortNo.Size = New System.Drawing.Size(49, 18)
        Me.Edit_OutPortNo.TabIndex = 24
        Me.Edit_OutPortNo.Text = "Text3"
        '
        'Button_EchoBackByte
        '
        Me.Button_EchoBackByte.BackColor = System.Drawing.SystemColors.Control
        Me.Button_EchoBackByte.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_EchoBackByte.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_EchoBackByte.Location = New System.Drawing.Point(440, 16)
        Me.Button_EchoBackByte.Name = "Button_EchoBackByte"
        Me.Button_EchoBackByte.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_EchoBackByte.Size = New System.Drawing.Size(112, 25)
        Me.Button_EchoBackByte.TabIndex = 20
        Me.Button_EchoBackByte.Text = "DioEchoBackByte"
        '
        'Button_OutByte
        '
        Me.Button_OutByte.BackColor = System.Drawing.SystemColors.Control
        Me.Button_OutByte.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_OutByte.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_OutByte.Location = New System.Drawing.Point(320, 16)
        Me.Button_OutByte.Name = "Button_OutByte"
        Me.Button_OutByte.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_OutByte.Size = New System.Drawing.Size(104, 25)
        Me.Button_OutByte.TabIndex = 16
        Me.Button_OutByte.Text = "DioOutByte"
        '
        'Label12
        '
        Me.Label12.BackColor = System.Drawing.SystemColors.Control
        Me.Label12.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label12.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label12.Location = New System.Drawing.Point(272, 24)
        Me.Label12.Name = "Label12"
        Me.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label12.Size = New System.Drawing.Size(49, 17)
        Me.Label12.TabIndex = 34
        Me.Label12.Text = "(Hex)"
        '
        'Label10
        '
        Me.Label10.BackColor = System.Drawing.SystemColors.Control
        Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label10.Location = New System.Drawing.Point(160, 24)
        Me.Label10.Name = "Label10"
        Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label10.Size = New System.Drawing.Size(73, 17)
        Me.Label10.TabIndex = 32
        Me.Label10.Text = "Output Data:"
        '
        'Label7
        '
        Me.Label7.BackColor = System.Drawing.SystemColors.Control
        Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label7.Location = New System.Drawing.Point(16, 24)
        Me.Label7.Name = "Label7"
        Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label7.Size = New System.Drawing.Size(89, 17)
        Me.Label7.TabIndex = 29
        Me.Label7.Text = "Logic PortNo:"
        '
        'Frame2
        '
        Me.Frame2.BackColor = System.Drawing.SystemColors.Control
        Me.Frame2.Controls.AddRange(New System.Windows.Forms.Control() {Me.Edit_InpBitData, Me.Edit_InpBitNo, Me.Button_InpBit, Me.Label9, Me.Label6})
        Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame2.Location = New System.Drawing.Point(8, 168)
        Me.Frame2.Name = "Frame2"
        Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame2.Size = New System.Drawing.Size(569, 49)
        Me.Frame2.TabIndex = 10
        Me.Frame2.TabStop = False
        Me.Frame2.Text = "1 Bit Input"
        '
        'Edit_InpBitData
        '
        Me.Edit_InpBitData.AcceptsReturn = True
        Me.Edit_InpBitData.AutoSize = False
        Me.Edit_InpBitData.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_InpBitData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_InpBitData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_InpBitData.Location = New System.Drawing.Point(232, 24)
        Me.Edit_InpBitData.MaxLength = 0
        Me.Edit_InpBitData.Name = "Edit_InpBitData"
        Me.Edit_InpBitData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_InpBitData.Size = New System.Drawing.Size(33, 18)
        Me.Edit_InpBitData.TabIndex = 23
        Me.Edit_InpBitData.Text = "Text2"
        '
        'Edit_InpBitNo
        '
        Me.Edit_InpBitNo.AcceptsReturn = True
        Me.Edit_InpBitNo.AutoSize = False
        Me.Edit_InpBitNo.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_InpBitNo.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_InpBitNo.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_InpBitNo.Location = New System.Drawing.Point(104, 24)
        Me.Edit_InpBitNo.MaxLength = 0
        Me.Edit_InpBitNo.Name = "Edit_InpBitNo"
        Me.Edit_InpBitNo.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_InpBitNo.Size = New System.Drawing.Size(49, 18)
        Me.Edit_InpBitNo.TabIndex = 22
        Me.Edit_InpBitNo.Text = "Text1"
        '
        'Button_InpBit
        '
        Me.Button_InpBit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_InpBit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_InpBit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_InpBit.Location = New System.Drawing.Point(320, 16)
        Me.Button_InpBit.Name = "Button_InpBit"
        Me.Button_InpBit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_InpBit.Size = New System.Drawing.Size(104, 25)
        Me.Button_InpBit.TabIndex = 15
        Me.Button_InpBit.Text = "DioInpBit"
        '
        'Label9
        '
        Me.Label9.BackColor = System.Drawing.SystemColors.Control
        Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label9.Location = New System.Drawing.Point(160, 24)
        Me.Label9.Name = "Label9"
        Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label9.Size = New System.Drawing.Size(65, 17)
        Me.Label9.TabIndex = 31
        Me.Label9.Text = "Input Data:"
        '
        'Label6
        '
        Me.Label6.BackColor = System.Drawing.SystemColors.Control
        Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label6.Location = New System.Drawing.Point(16, 24)
        Me.Label6.Name = "Label6"
        Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label6.Size = New System.Drawing.Size(81, 17)
        Me.Label6.TabIndex = 28
        Me.Label6.Text = "Logic BitNo:"
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button_InpByte, Me.Edit_InpPortData, Me.Edit_InpPortNo, Me.Label4, Me.Label3, Me.Label2})
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(8, 112)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(569, 49)
        Me.Frame1.TabIndex = 3
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "1 Port Input"
        '
        'Button_InpByte
        '
        Me.Button_InpByte.BackColor = System.Drawing.SystemColors.Control
        Me.Button_InpByte.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_InpByte.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_InpByte.Location = New System.Drawing.Point(320, 16)
        Me.Button_InpByte.Name = "Button_InpByte"
        Me.Button_InpByte.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_InpByte.Size = New System.Drawing.Size(104, 25)
        Me.Button_InpByte.TabIndex = 9
        Me.Button_InpByte.Text = "DioInpByte"
        '
        'Edit_InpPortData
        '
        Me.Edit_InpPortData.AcceptsReturn = True
        Me.Edit_InpPortData.AutoSize = False
        Me.Edit_InpPortData.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_InpPortData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_InpPortData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_InpPortData.Location = New System.Drawing.Point(232, 24)
        Me.Edit_InpPortData.MaxLength = 0
        Me.Edit_InpPortData.Name = "Edit_InpPortData"
        Me.Edit_InpPortData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_InpPortData.Size = New System.Drawing.Size(33, 18)
        Me.Edit_InpPortData.TabIndex = 7
        Me.Edit_InpPortData.Text = "Text3"
        '
        'Edit_InpPortNo
        '
        Me.Edit_InpPortNo.AcceptsReturn = True
        Me.Edit_InpPortNo.AutoSize = False
        Me.Edit_InpPortNo.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_InpPortNo.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_InpPortNo.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_InpPortNo.Location = New System.Drawing.Point(104, 24)
        Me.Edit_InpPortNo.MaxLength = 0
        Me.Edit_InpPortNo.Name = "Edit_InpPortNo"
        Me.Edit_InpPortNo.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_InpPortNo.Size = New System.Drawing.Size(49, 18)
        Me.Edit_InpPortNo.TabIndex = 4
        Me.Edit_InpPortNo.Text = "Text2"
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.SystemColors.Control
        Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label4.Location = New System.Drawing.Point(272, 24)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(57, 17)
        Me.Label4.TabIndex = 8
        Me.Label4.Text = "(Hex)"
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.SystemColors.Control
        Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(160, 24)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(73, 17)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "Input Data:"
        '
        'Label2
        '
        Me.Label2.BackColor = System.Drawing.SystemColors.Control
        Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label2.Location = New System.Drawing.Point(16, 24)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(89, 17)
        Me.Label2.TabIndex = 5
        Me.Label2.Text = "Logic PortNo:"
        '
        'Button_DioInit
        '
        Me.Button_DioInit.BackColor = System.Drawing.SystemColors.Control
        Me.Button_DioInit.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_DioInit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_DioInit.Location = New System.Drawing.Point(328, 16)
        Me.Button_DioInit.Name = "Button_DioInit"
        Me.Button_DioInit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_DioInit.Size = New System.Drawing.Size(104, 25)
        Me.Button_DioInit.TabIndex = 1
        Me.Button_DioInit.Text = "DioInit"
        '
        'Edit_DeviceName
        '
        Me.Edit_DeviceName.AcceptsReturn = True
        Me.Edit_DeviceName.AutoSize = False
        Me.Edit_DeviceName.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_DeviceName.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_DeviceName.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_DeviceName.Location = New System.Drawing.Point(104, 24)
        Me.Edit_DeviceName.MaxLength = 0
        Me.Edit_DeviceName.Name = "Edit_DeviceName"
        Me.Edit_DeviceName.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_DeviceName.Size = New System.Drawing.Size(97, 18)
        Me.Edit_DeviceName.TabIndex = 0
        Me.Edit_DeviceName.Text = "Text1"
        '
        'Label5
        '
        Me.Label5.BackColor = System.Drawing.SystemColors.Control
        Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label5.Location = New System.Drawing.Point(24, 344)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(73, 17)
        Me.Label5.TabIndex = 14
        Me.Label5.Text = "Return Code:"
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(24, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(80, 17)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Device Name:"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button_SetIoDirection, Me.Edit_DirData, Me.Label13})
        Me.GroupBox1.Location = New System.Drawing.Point(8, 56)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(569, 49)
        Me.GroupBox1.TabIndex = 20
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "I/O Set"
        '
        'Button_SetIoDirection
        '
        Me.Button_SetIoDirection.BackColor = System.Drawing.SystemColors.Control
        Me.Button_SetIoDirection.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_SetIoDirection.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_SetIoDirection.Location = New System.Drawing.Point(320, 16)
        Me.Button_SetIoDirection.Name = "Button_SetIoDirection"
        Me.Button_SetIoDirection.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_SetIoDirection.Size = New System.Drawing.Size(104, 25)
        Me.Button_SetIoDirection.TabIndex = 10
        Me.Button_SetIoDirection.Text = "DioSetIoDirection"
        '
        'Edit_DirData
        '
        Me.Edit_DirData.AcceptsReturn = True
        Me.Edit_DirData.AutoSize = False
        Me.Edit_DirData.BackColor = System.Drawing.SystemColors.Window
        Me.Edit_DirData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.Edit_DirData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Edit_DirData.Location = New System.Drawing.Point(104, 24)
        Me.Edit_DirData.MaxLength = 0
        Me.Edit_DirData.Name = "Edit_DirData"
        Me.Edit_DirData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Edit_DirData.Size = New System.Drawing.Size(88, 18)
        Me.Edit_DirData.TabIndex = 7
        Me.Edit_DirData.Text = "Text1"
        '
        'Label13
        '
        Me.Label13.BackColor = System.Drawing.SystemColors.Control
        Me.Label13.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label13.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label13.Location = New System.Drawing.Point(16, 24)
        Me.Label13.Name = "Label13"
        Me.Label13.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label13.Size = New System.Drawing.Size(89, 17)
        Me.Label13.TabIndex = 6
        Me.Label13.Text = "I/O Direction:"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(586, 414)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1, Me.Button_Exit, Me.Button_DioExit, Me.Edit_ReturnCode, Me.Frame4, Me.Frame3, Me.Frame2, Me.Frame1, Me.Button_DioInit, Me.Edit_DeviceName, Me.Label5, Me.Label1})
        Me.Location = New System.Drawing.Point(4, 23)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.Text = "Simple I/O"
        Me.Frame4.ResumeLayout(False)
        Me.Frame3.ResumeLayout(False)
        Me.Frame2.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub
#End Region
#Region "Upgrade Support "
    Private Shared m_vb6FormDefInstance As Form1
    Private Shared m_InitializingDefInstance As Boolean
    Public Shared Property DefInstance() As Form1
        Get
            If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
                m_InitializingDefInstance = True
                m_vb6FormDefInstance = New Form1()
                m_InitializingDefInstance = False
            End If
            DefInstance = m_vb6FormDefInstance
        End Get
        Set(ByVal Value As Form1)
            m_vb6FormDefInstance = Value
        End Set
    End Property
#End Region

    Dim Id As Short                             ' Device ID
    Dim Ret As Integer                          ' Return code
    Dim szError As New StringBuilder("", 256)   ' Error string
    Dim szText As New String("", 100)

    '---------------------------------------------------------
    ' Dialog Initialization
    '---------------------------------------------------------
    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

        Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2
        Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2

        ' Screen item initialization
        Edit_DeviceName.Text = "DIO000"
        Edit_DirData.Text = ""
        Edit_InpPortNo.Text = "0"
        Edit_InpBitNo.Text = "0"
        Edit_OutPortNo.Text = "0"
        Edit_OutBitNo.Text = "0"
        Edit_InpPortData.Text = ""
        Edit_InpBitData.Text = ""
        Edit_OutPortData.Text = "55"
        Edit_OutBitData.Text = "1"
        Edit_ReturnCode.Text = ""

    End Sub

    '---------------------------------------------------------
    ' Initialization Process
    '---------------------------------------------------------
    Private Sub Button_DioInit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_DioInit.Click

        Dim szDeviceName As String

        ' Get device name from screen
        szDeviceName = Edit_DeviceName.Text

        ' Execute initialization function and get ID
        Ret = DioInit(szDeviceName, Id)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()

    End Sub

    '---------------------------------------------------------
    ' Exit process
    '---------------------------------------------------------
    Private Sub Button_DioExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_DioExit.Click

        ' Exit function execute
        Ret = DioExit(Id)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()

    End Sub

    '---------------------------------------------------------
    ' Dialog exit
    '---------------------------------------------------------
    Private Sub Button_Exit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_Exit.Click

        ' Exit function execute
        Ret = DioExit(Id)

        ' Dialog exit
        End

    End Sub

    '---------------------------------------------------------
    ' 1 port input
    '---------------------------------------------------------
    Private Sub Button_InpByte_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_InpByte.Click

        Dim InpPortNo As Short
        Dim InpPortData As Byte
        Dim timestamp As UShort
        Dim mode As Byte

        ' Get port No. from screen
        szText = Edit_InpPortNo.Text
        InpPortNo = Val(szText)

        ' Direct access to device
        mode = DIONET_MODE_DIRECT

        ' Port input
        Ret = DioInpByteSR(Id, InpPortNo, InpPortData, timestamp, mode)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

        ' Data express
        Edit_InpPortData.Text = Hex(InpPortData)

    End Sub

    '---------------------------------------------------------
    ' 1 bit input
    '---------------------------------------------------------
    Private Sub Button_InpBit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_InpBit.Click

        Dim InpBitNo As Short
        Dim InpBitData As Byte
        Dim timestamp As UShort
        Dim mode As Byte

        ' Get bit No. from screen
        szText = Edit_InpBitNo.Text
        InpBitNo = Val(szText)

        ' Direct access to device
        mode = DIONET_MODE_DIRECT

        ' Bit input
        Ret = DioInpBitSR(Id, InpBitNo, InpBitData, timestamp, mode)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

        ' Data express
        Edit_InpBitData.Text = CStr(InpBitData)

    End Sub

    '---------------------------------------------------------
    ' 1 port output
    '---------------------------------------------------------
    Private Sub Button_OutByte_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_OutByte.Click

        Dim OutPortNo As Short
        Dim OutPortData As Byte

        ' Get port No. and output data from screen
        szText = Edit_OutPortNo.Text
        OutPortNo = Val(szText)
        szText = Edit_OutPortData.Text
        OutPortData = Val("&H" & szText)

        ' Port output
        Ret = DioOutByte(Id, OutPortNo, OutPortData)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

    End Sub

    '---------------------------------------------------------
    ' 1 bit output
    '---------------------------------------------------------
    Private Sub Button_OutBit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_OutBit.Click

        Dim OutBitNo As Short
        Dim OutBitData As Byte

        ' Get bit No. and output data from screen
        szText = Edit_OutBitNo.Text
        OutBitNo = Val(szText)
        szText = Edit_OutBitData.Text
        OutBitData = Val("&H" & szText)

        ' Bit output
        Ret = DioOutBit(Id, OutBitNo, OutBitData)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

    End Sub

    '---------------------------------------------------------
    ' 1 port EchoBack
    '---------------------------------------------------------
    Private Sub Button_EchoBackByte_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_EchoBackByte.Click

        Dim OutPortNo As Short
        Dim OutPortData As Byte

        ' Get port No. from screen
        szText = Edit_OutPortNo.Text
        OutPortNo = Val(szText)

        ' Port EchoBack
        Ret = DioEchoBackByte(Id, OutPortNo, OutPortData)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

        ' Data express
        Edit_OutPortData.Text = Hex(OutPortData)            '-----------%02X

    End Sub

    '---------------------------------------------------------
    ' 1 Bit EchoBack
    '---------------------------------------------------------
    Private Sub Button_EchoBackBit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_EchoBackBit.Click

        Dim OutBitNo As Short
        Dim OutBitData As Byte

        ' Get bit No. from screen
        szText = Edit_OutBitNo.Text
        OutBitNo = Val(szText)

        ' Port input
        Ret = DioEchoBackBit(Id, OutBitNo, OutBitData)

        ' Error process
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If

        ' Data Express
        Edit_OutBitData.Text = Hex(OutBitData)              '----------%02X

    End Sub

    '---------------------------------------------------------
    ' Set IoDirection
    ' It can be used only by the devices support the function.
    '---------------------------------------------------------
    Private Sub Button_SetIoDirection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_SetIoDirection.Click
        Dim dwDir As Integer

        '-----------------------------
        ' Get IoDirection
        '-----------------------------
        szText = Edit_DirData.Text
        dwDir = Val("&H" & szText)
        '-----------------------------
        ' Set IoDirection
        '-----------------------------
        Ret = DioSetIoDirection(Id, dwDir)
        '-----------------------------
        ' Error process
        '-----------------------------
        Call DioGetErrorString(Ret, szError)
        Edit_ReturnCode.Text = "Ret = " & Ret & ":" & szError.ToString()
        If (Ret <> DIO_ERR_SUCCESS) Then
            Exit Sub
        End If
    End Sub
End Class