﻿Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports System.Text

Friend Class Trigger
	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 Edit_ReturnCode As System.Windows.Forms.TextBox
    Public WithEvents Button_DioExit As System.Windows.Forms.Button
	Public WithEvents Button_Exit As System.Windows.Forms.Button
	Public WithEvents _Check_7 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_6 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_5 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_4 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_3 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_2 As System.Windows.Forms.CheckBox
	Public WithEvents _Check_1 As System.Windows.Forms.CheckBox
	Public WithEvents Button_Trigger As System.Windows.Forms.Button
	Public WithEvents _Check_0 As System.Windows.Forms.CheckBox
	Public WithEvents _Edit_Down_7 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_6 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_5 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_4 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_3 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_2 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_1 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Down_0 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_7 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_6 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_5 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_4 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_3 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_2 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_1 As System.Windows.Forms.TextBox
	Public WithEvents _Edit_Up_0 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_DioIint 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.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.Edit_ReturnCode = New System.Windows.Forms.TextBox
        Me.Button_DioExit = New System.Windows.Forms.Button
        Me.Button_Exit = New System.Windows.Forms.Button
        Me.Frame1 = New System.Windows.Forms.GroupBox
        Me._Check_7 = New System.Windows.Forms.CheckBox
        Me._Check_6 = New System.Windows.Forms.CheckBox
        Me._Check_5 = New System.Windows.Forms.CheckBox
        Me._Check_4 = New System.Windows.Forms.CheckBox
        Me._Check_3 = New System.Windows.Forms.CheckBox
        Me._Check_2 = New System.Windows.Forms.CheckBox
        Me._Check_1 = New System.Windows.Forms.CheckBox
        Me.Button_Trigger = New System.Windows.Forms.Button
        Me._Check_0 = New System.Windows.Forms.CheckBox
        Me._Edit_Down_7 = New System.Windows.Forms.TextBox
        Me._Edit_Down_6 = New System.Windows.Forms.TextBox
        Me._Edit_Down_5 = New System.Windows.Forms.TextBox
        Me._Edit_Down_4 = New System.Windows.Forms.TextBox
        Me._Edit_Down_3 = New System.Windows.Forms.TextBox
        Me._Edit_Down_2 = New System.Windows.Forms.TextBox
        Me._Edit_Down_1 = New System.Windows.Forms.TextBox
        Me._Edit_Down_0 = New System.Windows.Forms.TextBox
        Me._Edit_Up_7 = New System.Windows.Forms.TextBox
        Me._Edit_Up_6 = New System.Windows.Forms.TextBox
        Me._Edit_Up_5 = New System.Windows.Forms.TextBox
        Me._Edit_Up_4 = New System.Windows.Forms.TextBox
        Me._Edit_Up_3 = New System.Windows.Forms.TextBox
        Me._Edit_Up_2 = New System.Windows.Forms.TextBox
        Me._Edit_Up_1 = New System.Windows.Forms.TextBox
        Me._Edit_Up_0 = 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_DioIint = 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.Frame1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Edit_ReturnCode
        '
        Me.Edit_ReturnCode.AcceptsReturn = True
        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(80, 243)
        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(249, 19)
        Me.Edit_ReturnCode.TabIndex = 34
        Me.Edit_ReturnCode.Text = "Text1"
        '
        '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(352, 243)
        Me.Button_DioExit.Name = "Button_DioExit"
        Me.Button_DioExit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_DioExit.Size = New System.Drawing.Size(113, 21)
        Me.Button_DioExit.TabIndex = 33
        Me.Button_DioExit.Text = "DioExit"
        Me.Button_DioExit.UseVisualStyleBackColor = False
        '
        '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(352, 286)
        Me.Button_Exit.Name = "Button_Exit"
        Me.Button_Exit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_Exit.Size = New System.Drawing.Size(113, 22)
        Me.Button_Exit.TabIndex = 32
        Me.Button_Exit.Text = "Exit"
        Me.Button_Exit.UseVisualStyleBackColor = False
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.Add(Me._Check_7)
        Me.Frame1.Controls.Add(Me._Check_6)
        Me.Frame1.Controls.Add(Me._Check_5)
        Me.Frame1.Controls.Add(Me._Check_4)
        Me.Frame1.Controls.Add(Me._Check_3)
        Me.Frame1.Controls.Add(Me._Check_2)
        Me.Frame1.Controls.Add(Me._Check_1)
        Me.Frame1.Controls.Add(Me.Button_Trigger)
        Me.Frame1.Controls.Add(Me._Check_0)
        Me.Frame1.Controls.Add(Me._Edit_Down_7)
        Me.Frame1.Controls.Add(Me._Edit_Down_6)
        Me.Frame1.Controls.Add(Me._Edit_Down_5)
        Me.Frame1.Controls.Add(Me._Edit_Down_4)
        Me.Frame1.Controls.Add(Me._Edit_Down_3)
        Me.Frame1.Controls.Add(Me._Edit_Down_2)
        Me.Frame1.Controls.Add(Me._Edit_Down_1)
        Me.Frame1.Controls.Add(Me._Edit_Down_0)
        Me.Frame1.Controls.Add(Me._Edit_Up_7)
        Me.Frame1.Controls.Add(Me._Edit_Up_6)
        Me.Frame1.Controls.Add(Me._Edit_Up_5)
        Me.Frame1.Controls.Add(Me._Edit_Up_4)
        Me.Frame1.Controls.Add(Me._Edit_Up_3)
        Me.Frame1.Controls.Add(Me._Edit_Up_2)
        Me.Frame1.Controls.Add(Me._Edit_Up_1)
        Me.Frame1.Controls.Add(Me._Edit_Up_0)
        Me.Frame1.Controls.Add(Me.Label4)
        Me.Frame1.Controls.Add(Me.Label3)
        Me.Frame1.Controls.Add(Me.Label2)
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(8, 61)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(473, 165)
        Me.Frame1.TabIndex = 3
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Trigger"
        '
        '_Check_7
        '
        Me._Check_7.BackColor = System.Drawing.SystemColors.Control
        Me._Check_7.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_7.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_7.Location = New System.Drawing.Point(436, 95)
        Me._Check_7.Name = "_Check_7"
        Me._Check_7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_7.Size = New System.Drawing.Size(17, 19)
        Me._Check_7.TabIndex = 28
        Me._Check_7.Tag = "7"
        Me._Check_7.Text = "Check1"
        Me._Check_7.UseVisualStyleBackColor = False
        '
        '_Check_6
        '
        Me._Check_6.BackColor = System.Drawing.SystemColors.Control
        Me._Check_6.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_6.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_6.Location = New System.Drawing.Point(394, 95)
        Me._Check_6.Name = "_Check_6"
        Me._Check_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_6.Size = New System.Drawing.Size(17, 19)
        Me._Check_6.TabIndex = 27
        Me._Check_6.Tag = "6"
        Me._Check_6.Text = "Check1"
        Me._Check_6.UseVisualStyleBackColor = False
        '
        '_Check_5
        '
        Me._Check_5.BackColor = System.Drawing.SystemColors.Control
        Me._Check_5.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_5.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_5.Location = New System.Drawing.Point(348, 95)
        Me._Check_5.Name = "_Check_5"
        Me._Check_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_5.Size = New System.Drawing.Size(17, 19)
        Me._Check_5.TabIndex = 26
        Me._Check_5.Tag = "5"
        Me._Check_5.Text = "Check1"
        Me._Check_5.UseVisualStyleBackColor = False
        '
        '_Check_4
        '
        Me._Check_4.BackColor = System.Drawing.SystemColors.Control
        Me._Check_4.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_4.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_4.Location = New System.Drawing.Point(307, 95)
        Me._Check_4.Name = "_Check_4"
        Me._Check_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_4.Size = New System.Drawing.Size(17, 19)
        Me._Check_4.TabIndex = 25
        Me._Check_4.Tag = "4"
        Me._Check_4.Text = "Check1"
        Me._Check_4.UseVisualStyleBackColor = False
        '
        '_Check_3
        '
        Me._Check_3.BackColor = System.Drawing.SystemColors.Control
        Me._Check_3.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_3.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_3.Location = New System.Drawing.Point(264, 95)
        Me._Check_3.Name = "_Check_3"
        Me._Check_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_3.Size = New System.Drawing.Size(17, 19)
        Me._Check_3.TabIndex = 24
        Me._Check_3.Tag = "3"
        Me._Check_3.Text = "Check1"
        Me._Check_3.UseVisualStyleBackColor = False
        '
        '_Check_2
        '
        Me._Check_2.BackColor = System.Drawing.SystemColors.Control
        Me._Check_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_2.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_2.Location = New System.Drawing.Point(220, 95)
        Me._Check_2.Name = "_Check_2"
        Me._Check_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_2.Size = New System.Drawing.Size(17, 19)
        Me._Check_2.TabIndex = 23
        Me._Check_2.Tag = "2"
        Me._Check_2.Text = "Check1"
        Me._Check_2.UseVisualStyleBackColor = False
        '
        '_Check_1
        '
        Me._Check_1.BackColor = System.Drawing.SystemColors.Control
        Me._Check_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_1.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_1.Location = New System.Drawing.Point(176, 95)
        Me._Check_1.Name = "_Check_1"
        Me._Check_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_1.Size = New System.Drawing.Size(17, 19)
        Me._Check_1.TabIndex = 22
        Me._Check_1.Tag = "1"
        Me._Check_1.Text = "Check1"
        Me._Check_1.UseVisualStyleBackColor = False
        '
        'Button_Trigger
        '
        Me.Button_Trigger.BackColor = System.Drawing.SystemColors.Control
        Me.Button_Trigger.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_Trigger.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_Trigger.Location = New System.Drawing.Point(344, 130)
        Me.Button_Trigger.Name = "Button_Trigger"
        Me.Button_Trigger.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_Trigger.Size = New System.Drawing.Size(113, 22)
        Me.Button_Trigger.TabIndex = 21
        Me.Button_Trigger.Text = "Trigger Start"
        Me.Button_Trigger.UseVisualStyleBackColor = False
        '
        '_Check_0
        '
        Me._Check_0.BackColor = System.Drawing.SystemColors.Control
        Me._Check_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._Check_0.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Check_0.Location = New System.Drawing.Point(128, 95)
        Me._Check_0.Name = "_Check_0"
        Me._Check_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Check_0.Size = New System.Drawing.Size(17, 19)
        Me._Check_0.TabIndex = 20
        Me._Check_0.Tag = "0"
        Me._Check_0.Text = "Check1"
        Me._Check_0.UseVisualStyleBackColor = False
        '
        '_Edit_Down_7
        '
        Me._Edit_Down_7.AcceptsReturn = True
        Me._Edit_Down_7.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_7.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_7.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_7.Location = New System.Drawing.Point(424, 69)
        Me._Edit_Down_7.MaxLength = 0
        Me._Edit_Down_7.Name = "_Edit_Down_7"
        Me._Edit_Down_7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_7.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_7.TabIndex = 19
        '
        '_Edit_Down_6
        '
        Me._Edit_Down_6.AcceptsReturn = True
        Me._Edit_Down_6.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_6.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_6.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_6.Location = New System.Drawing.Point(382, 69)
        Me._Edit_Down_6.MaxLength = 0
        Me._Edit_Down_6.Name = "_Edit_Down_6"
        Me._Edit_Down_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_6.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_6.TabIndex = 18
        '
        '_Edit_Down_5
        '
        Me._Edit_Down_5.AcceptsReturn = True
        Me._Edit_Down_5.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_5.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_5.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_5.Location = New System.Drawing.Point(339, 69)
        Me._Edit_Down_5.MaxLength = 0
        Me._Edit_Down_5.Name = "_Edit_Down_5"
        Me._Edit_Down_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_5.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_5.TabIndex = 17
        '
        '_Edit_Down_4
        '
        Me._Edit_Down_4.AcceptsReturn = True
        Me._Edit_Down_4.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_4.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_4.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_4.Location = New System.Drawing.Point(296, 69)
        Me._Edit_Down_4.MaxLength = 0
        Me._Edit_Down_4.Name = "_Edit_Down_4"
        Me._Edit_Down_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_4.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_4.TabIndex = 16
        '
        '_Edit_Down_3
        '
        Me._Edit_Down_3.AcceptsReturn = True
        Me._Edit_Down_3.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_3.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_3.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_3.Location = New System.Drawing.Point(252, 69)
        Me._Edit_Down_3.MaxLength = 0
        Me._Edit_Down_3.Name = "_Edit_Down_3"
        Me._Edit_Down_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_3.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_3.TabIndex = 15
        '
        '_Edit_Down_2
        '
        Me._Edit_Down_2.AcceptsReturn = True
        Me._Edit_Down_2.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_2.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_2.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_2.Location = New System.Drawing.Point(208, 69)
        Me._Edit_Down_2.MaxLength = 0
        Me._Edit_Down_2.Name = "_Edit_Down_2"
        Me._Edit_Down_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_2.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_2.TabIndex = 14
        '
        '_Edit_Down_1
        '
        Me._Edit_Down_1.AcceptsReturn = True
        Me._Edit_Down_1.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_1.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_1.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_1.Location = New System.Drawing.Point(164, 69)
        Me._Edit_Down_1.MaxLength = 0
        Me._Edit_Down_1.Name = "_Edit_Down_1"
        Me._Edit_Down_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_1.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_1.TabIndex = 13
        '
        '_Edit_Down_0
        '
        Me._Edit_Down_0.AcceptsReturn = True
        Me._Edit_Down_0.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Down_0.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Down_0.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Down_0.Location = New System.Drawing.Point(120, 69)
        Me._Edit_Down_0.MaxLength = 0
        Me._Edit_Down_0.Name = "_Edit_Down_0"
        Me._Edit_Down_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Down_0.Size = New System.Drawing.Size(39, 22)
        Me._Edit_Down_0.TabIndex = 12
        '
        '_Edit_Up_7
        '
        Me._Edit_Up_7.AcceptsReturn = True
        Me._Edit_Up_7.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_7.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_7.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_7.Location = New System.Drawing.Point(424, 35)
        Me._Edit_Up_7.MaxLength = 0
        Me._Edit_Up_7.Name = "_Edit_Up_7"
        Me._Edit_Up_7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_7.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_7.TabIndex = 11
        '
        '_Edit_Up_6
        '
        Me._Edit_Up_6.AcceptsReturn = True
        Me._Edit_Up_6.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_6.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_6.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_6.Location = New System.Drawing.Point(382, 35)
        Me._Edit_Up_6.MaxLength = 0
        Me._Edit_Up_6.Name = "_Edit_Up_6"
        Me._Edit_Up_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_6.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_6.TabIndex = 10
        '
        '_Edit_Up_5
        '
        Me._Edit_Up_5.AcceptsReturn = True
        Me._Edit_Up_5.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_5.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_5.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_5.Location = New System.Drawing.Point(339, 35)
        Me._Edit_Up_5.MaxLength = 0
        Me._Edit_Up_5.Name = "_Edit_Up_5"
        Me._Edit_Up_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_5.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_5.TabIndex = 9
        '
        '_Edit_Up_4
        '
        Me._Edit_Up_4.AcceptsReturn = True
        Me._Edit_Up_4.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_4.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_4.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_4.Location = New System.Drawing.Point(296, 35)
        Me._Edit_Up_4.MaxLength = 0
        Me._Edit_Up_4.Name = "_Edit_Up_4"
        Me._Edit_Up_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_4.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_4.TabIndex = 8
        '
        '_Edit_Up_3
        '
        Me._Edit_Up_3.AcceptsReturn = True
        Me._Edit_Up_3.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_3.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_3.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_3.Location = New System.Drawing.Point(252, 35)
        Me._Edit_Up_3.MaxLength = 0
        Me._Edit_Up_3.Name = "_Edit_Up_3"
        Me._Edit_Up_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_3.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_3.TabIndex = 7
        '
        '_Edit_Up_2
        '
        Me._Edit_Up_2.AcceptsReturn = True
        Me._Edit_Up_2.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_2.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_2.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_2.Location = New System.Drawing.Point(208, 35)
        Me._Edit_Up_2.MaxLength = 0
        Me._Edit_Up_2.Name = "_Edit_Up_2"
        Me._Edit_Up_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_2.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_2.TabIndex = 6
        '
        '_Edit_Up_1
        '
        Me._Edit_Up_1.AcceptsReturn = True
        Me._Edit_Up_1.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_1.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_1.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_1.Location = New System.Drawing.Point(164, 35)
        Me._Edit_Up_1.MaxLength = 0
        Me._Edit_Up_1.Name = "_Edit_Up_1"
        Me._Edit_Up_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_1.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_1.TabIndex = 5
        '
        '_Edit_Up_0
        '
        Me._Edit_Up_0.AcceptsReturn = True
        Me._Edit_Up_0.BackColor = System.Drawing.SystemColors.Window
        Me._Edit_Up_0.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Edit_Up_0.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Edit_Up_0.Location = New System.Drawing.Point(120, 35)
        Me._Edit_Up_0.MaxLength = 0
        Me._Edit_Up_0.Name = "_Edit_Up_0"
        Me._Edit_Up_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Edit_Up_0.Size = New System.Drawing.Size(39, 21)
        Me._Edit_Up_0.TabIndex = 4
        '
        '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(24, 95)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(81, 19)
        Me.Label4.TabIndex = 31
        Me.Label4.Text = "Valid/Invalid:"
        '
        '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(24, 69)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(81, 19)
        Me.Label3.TabIndex = 30
        Me.Label3.Text = "Down-count:"
        '
        '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(24, 35)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(81, 18)
        Me.Label2.TabIndex = 29
        Me.Label2.Text = "Up-count:"
        '
        'Button_DioIint
        '
        Me.Button_DioIint.BackColor = System.Drawing.SystemColors.Control
        Me.Button_DioIint.Cursor = System.Windows.Forms.Cursors.Default
        Me.Button_DioIint.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Button_DioIint.Location = New System.Drawing.Point(352, 26)
        Me.Button_DioIint.Name = "Button_DioIint"
        Me.Button_DioIint.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Button_DioIint.Size = New System.Drawing.Size(113, 22)
        Me.Button_DioIint.TabIndex = 2
        Me.Button_DioIint.Text = "DioInit"
        Me.Button_DioIint.UseVisualStyleBackColor = False
        '
        'Edit_DeviceName
        '
        Me.Edit_DeviceName.AcceptsReturn = True
        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, 26)
        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, 20)
        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(8, 243)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(73, 18)
        Me.Label5.TabIndex = 35
        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(16, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(81, 18)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Device Name:"
        '
        'Trigger
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(492, 327)
        Me.Controls.Add(Me.Edit_ReturnCode)
        Me.Controls.Add(Me.Button_DioExit)
        Me.Controls.Add(Me.Button_Exit)
        Me.Controls.Add(Me.Frame1)
        Me.Controls.Add(Me.Button_DioIint)
        Me.Controls.Add(Me.Edit_DeviceName)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label1)
        Me.Location = New System.Drawing.Point(4, 23)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Trigger"
        Me.Text = "Trigger"
        Me.Frame1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As Trigger
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As Trigger
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New Trigger()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			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)
    Dim UpCount(8) As Short                     ' Up Counter
    Dim DownCount(8) As Short                   ' Down Counter
	
    Dim Check(7) As CheckBox
    Dim Edit_Up(7) As TextBox
    Dim Edit_Down(7) As TextBox

	'---------------------------------------------------------
	' Dialog Initialization
	'---------------------------------------------------------
	Private Sub Trigger_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		
		Dim i As Short
		
        Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2
        Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2

        Check(0) = _Check_0
        Check(1) = _Check_1
        Check(2) = _Check_2
        Check(3) = _Check_3
        Check(4) = _Check_4
        Check(5) = _Check_5
        Check(6) = _Check_6
        Check(7) = _Check_7

        Edit_Up(0) = _Edit_Up_0
        Edit_Up(1) = _Edit_Up_1
        Edit_Up(2) = _Edit_Up_2
        Edit_Up(3) = _Edit_Up_3
        Edit_Up(4) = _Edit_Up_4
        Edit_Up(5) = _Edit_Up_5
        Edit_Up(6) = _Edit_Up_6
        Edit_Up(7) = _Edit_Up_7

        Edit_Down(0) = _Edit_Down_0
        Edit_Down(1) = _Edit_Down_1
        Edit_Down(2) = _Edit_Down_2
        Edit_Down(3) = _Edit_Down_3
        Edit_Down(4) = _Edit_Down_4
        Edit_Down(5) = _Edit_Down_5
        Edit_Down(6) = _Edit_Down_6
        Edit_Down(7) = _Edit_Down_7

        ' Screen Item Initialization
        Edit_DeviceName.Text = "DIO000"
        Edit_ReturnCode.Text = ""

        ' Up counter
        For i = 0 To 7
            Edit_Up(i).Text = ""
        Next i

        ' Down counter
        For i = 0 To 7
            Edit_Down(i).Text = ""
        Next i

        For i = 0 To 7
            Check(i).Checked = True
        Next
        Edit_ReturnCode.Text = ""

    End Sub

    '---------------------------------------------------------
    ' Initialization Process
    '---------------------------------------------------------
    Private Sub Button_DioIint_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_DioIint.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 process 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

    '---------------------------------------------------------
    ' Trigger observe start
    '---------------------------------------------------------
    Private Sub Button_Trigger_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_Trigger.Click

        Dim i As Short
        Dim BitNo As Short
        Dim Kind As Short
        Dim Tim As Integer

        ' Parameters initialization
        For i = 0 To 7
            UpCount(i) = 0                      ' Up counter
            DownCount(i) = 0                    ' Down counter
        Next i

        ' Witch check
        Tim = 100                               ' Oberve in cycle 100ms
        Kind = DIO_TRG_RISE Or DIO_TRG_FALL     ' Observe both of Up/Down
        For BitNo = 0 To 7

            ' Trigger start
            If Check(BitNo).CheckState = 1 Then
                Ret = DioNotifyTrg(Id, BitNo, Kind, Tim, Me.Handle)
                If (Ret <> DIO_ERR_SUCCESS) Then
                    Exit For
                End If

                ' Trigger stop
            Else
                Ret = DioStopNotifyTrg(Id, BitNo)
                If (Ret <> DIO_ERR_SUCCESS) Then
                    Exit For
                End If
            End If
        Next BitNo

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

    End Sub

    '---------------------------------------------------------
    ' SubroutineFCheck process
    '---------------------------------------------------------
    Function CheckProcess(ByRef BitNo As Short) As Object

        Dim Tim As Integer          ' Oberve in cycle 100ms
        Dim Kind As Short           ' Observe both of Up/Down

        Tim = 100
        Kind = DIO_TRG_RISE Or DIO_TRG_FALL

        ' Trigger start
        If Check(BitNo).CheckState = 1 Then
            Ret = DioNotifyTrg(Id, BitNo, Kind, Tim, Me.Handle)

            ' Trigger stop
        Else
            Ret = DioStopNotifyTrg(Id, BitNo)
        End If

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

    '---------------------------------------------------------
    ' Check process
    '---------------------------------------------------------
    Private Sub Check_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_0.CheckedChanged
        Call CheckProcess(0)
    End Sub

    Private Sub _Check_1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_1.CheckedChanged
        Call CheckProcess(1)
    End Sub

    Private Sub _Check_2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_2.CheckedChanged
        Call CheckProcess(2)
    End Sub

    Private Sub _Check_3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_3.CheckedChanged
        Call CheckProcess(3)
    End Sub

    Private Sub _Check_4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_4.CheckedChanged
        Call CheckProcess(4)
    End Sub

    Private Sub _Check_5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_5.CheckedChanged
        Call CheckProcess(5)
    End Sub

    Private Sub _Check_6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_6.CheckedChanged
        Call CheckProcess(6)
    End Sub

    Private Sub _Check_7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _Check_7.CheckedChanged
        Call CheckProcess(7)
    End Sub

    '---------------------------------------------------------
    ' Subroutine: Get HIWORD,LOWORD
    '---------------------------------------------------------
    Function HiLoWord(ByRef Number As Integer, ByRef HiLo As Short) As Integer

        Dim Hi As Integer
        Dim Lo As Integer
        Dim StrData As String
        Dim i As Short

        StrData = Hex(Number)
        If Len(StrData) < 8 Then
            For i = 1 To 8 - Len(StrData)
                StrData = "0" & StrData
            Next i
        End If

        Lo = Val("&h" & VB.Right(StrData, 4))
        Hi = Val("&h" & VB.Left(StrData, 4))
        If HiLo = 0 Then
            HiLoWord = Lo
        ElseIf HiLo = 1 Then
            HiLoWord = Hi
        End If

    End Function

    '---------------------------------------------------------
    ' Message handler
    '---------------------------------------------------------
    Protected Overrides Sub WndProc(ByRef m As Message)
        Dim BitNo As Short
        Dim Id As Short
        Dim Kind As Short

        '--------------------------------------
        ' trigger Message 
        '--------------------------------------
        If m.Msg = DIOM_TRIGGER Then

            Id = HiLoWord(m.WParam.ToInt32(), 0)             'ID getted from DioInit function
            BitNo = HiLoWord(m.LParam.ToInt32(), 0)          'Trigger BitNo
            Kind = HiLoWord(m.LParam.ToInt32(), 1)           'StartUp1, StartDown2, Both Sides3

            If (Kind And DIO_INT_RISE) Then
                UpCount(BitNo) = UpCount(BitNo) + 1          'Up counter
            End If
            If (Kind And DIO_INT_FALL) Then
                DownCount(BitNo) = DownCount(BitNo) + 1      'Down counter
            End If
            '--------------------------------------
            ' Expression
            '--------------------------------------
            Edit_Up(BitNo).Text = CStr(UpCount(BitNo))
            Edit_Down(BitNo).Text = CStr(DownCount(BitNo))
        End If

        MyBase.WndProc(m)
    End Sub

End Class