﻿Option Strict Off
Option Explicit On 
Friend Class InOutSet
	Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

	Public Sub New()
		MyBase.New()

		'This call is required by the Windows Form Designer.
		InitializeComponent()

		'Add any initialization after the InitializeComponent() call

	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

	'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
	Friend WithEvents Label1 As System.Windows.Forms.Label
	Friend WithEvents Label2 As System.Windows.Forms.Label
	Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
	Friend WithEvents Label3 As System.Windows.Forms.Label
	Friend WithEvents Label4 As System.Windows.Forms.Label
	Friend WithEvents Label5 As System.Windows.Forms.Label
	Friend WithEvents Label6 As System.Windows.Forms.Label
	Friend WithEvents Label7 As System.Windows.Forms.Label
	Friend WithEvents Label8 As System.Windows.Forms.Label
	Friend WithEvents Label9 As System.Windows.Forms.Label
	Friend WithEvents Label10 As System.Windows.Forms.Label
	Friend WithEvents Label11 As System.Windows.Forms.Label
	Friend WithEvents cboOut1 As System.Windows.Forms.ComboBox
	Friend WithEvents cboOut3 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn1 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn3 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn5 As System.Windows.Forms.ComboBox
	Friend WithEvents cboInFilter As System.Windows.Forms.ComboBox
	Friend WithEvents cboSDMode As System.Windows.Forms.ComboBox
	Friend WithEvents cboOut2 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn2 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn4 As System.Windows.Forms.ComboBox
	Friend WithEvents cboIn6 As System.Windows.Forms.ComboBox
    Friend WithEvents btnComReturn As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.cboOut2 = New System.Windows.Forms.ComboBox()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.cboOut3 = New System.Windows.Forms.ComboBox()
        Me.cboOut1 = New System.Windows.Forms.ComboBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.cboIn6 = New System.Windows.Forms.ComboBox()
        Me.cboIn4 = New System.Windows.Forms.ComboBox()
        Me.cboIn2 = New System.Windows.Forms.ComboBox()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.cboIn5 = New System.Windows.Forms.ComboBox()
        Me.cboIn3 = New System.Windows.Forms.ComboBox()
        Me.cboIn1 = New System.Windows.Forms.ComboBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.cboInFilter = New System.Windows.Forms.ComboBox()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.cboSDMode = New System.Windows.Forms.ComboBox()
        Me.btnComReturn = New System.Windows.Forms.Button()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.cboOut2, Me.Label8, Me.cboOut3, Me.cboOut1, Me.Label2, Me.Label1})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(520, 96)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "OUT Setting"
        '
        'cboOut2
        '
        Me.cboOut2.Location = New System.Drawing.Point(328, 24)
        Me.cboOut2.Name = "cboOut2"
        Me.cboOut2.Size = New System.Drawing.Size(184, 23)
        Me.cboOut2.TabIndex = 5
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.Location = New System.Drawing.Point(280, 26)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(41, 14)
        Me.Label8.TabIndex = 4
        Me.Label8.Text = "OUT 2"
        '
        'cboOut3
        '
        Me.cboOut3.Location = New System.Drawing.Point(72, 56)
        Me.cboOut3.Name = "cboOut3"
        Me.cboOut3.Size = New System.Drawing.Size(184, 23)
        Me.cboOut3.TabIndex = 3
        '
        'cboOut1
        '
        Me.cboOut1.Location = New System.Drawing.Point(72, 24)
        Me.cboOut1.Name = "cboOut1"
        Me.cboOut1.Size = New System.Drawing.Size(184, 23)
        Me.cboOut1.TabIndex = 2
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(16, 58)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(41, 14)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "OUT 3"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(16, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(41, 14)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "OUT 1"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.cboIn6, Me.cboIn4, Me.cboIn2, Me.Label11, Me.Label10, Me.Label9, Me.cboIn5, Me.cboIn3, Me.cboIn1, Me.Label5, Me.Label4, Me.Label3})
        Me.GroupBox2.Location = New System.Drawing.Point(16, 120)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(520, 128)
        Me.GroupBox2.TabIndex = 1
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "IN Setting"
        '
        'cboIn6
        '
        Me.cboIn6.Location = New System.Drawing.Point(328, 88)
        Me.cboIn6.Name = "cboIn6"
        Me.cboIn6.Size = New System.Drawing.Size(184, 23)
        Me.cboIn6.TabIndex = 11
        '
        'cboIn4
        '
        Me.cboIn4.Location = New System.Drawing.Point(328, 56)
        Me.cboIn4.Name = "cboIn4"
        Me.cboIn4.Size = New System.Drawing.Size(184, 23)
        Me.cboIn4.TabIndex = 10
        '
        'cboIn2
        '
        Me.cboIn2.Location = New System.Drawing.Point(328, 24)
        Me.cboIn2.Name = "cboIn2"
        Me.cboIn2.Size = New System.Drawing.Size(184, 23)
        Me.cboIn2.TabIndex = 9
        '
        'Label11
        '
        Me.Label11.AutoSize = True
        Me.Label11.Location = New System.Drawing.Point(280, 92)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(27, 14)
        Me.Label11.TabIndex = 8
        Me.Label11.Text = "IN 6"
        '
        'Label10
        '
        Me.Label10.AutoSize = True
        Me.Label10.Location = New System.Drawing.Point(280, 60)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(27, 14)
        Me.Label10.TabIndex = 7
        Me.Label10.Text = "IN 4"
        '
        'Label9
        '
        Me.Label9.AutoSize = True
        Me.Label9.Location = New System.Drawing.Point(280, 28)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(27, 14)
        Me.Label9.TabIndex = 6
        Me.Label9.Text = "IN 2"
        '
        'cboIn5
        '
        Me.cboIn5.Location = New System.Drawing.Point(72, 88)
        Me.cboIn5.Name = "cboIn5"
        Me.cboIn5.Size = New System.Drawing.Size(184, 23)
        Me.cboIn5.TabIndex = 5
        '
        'cboIn3
        '
        Me.cboIn3.Location = New System.Drawing.Point(72, 56)
        Me.cboIn3.Name = "cboIn3"
        Me.cboIn3.Size = New System.Drawing.Size(184, 23)
        Me.cboIn3.TabIndex = 4
        '
        'cboIn1
        '
        Me.cboIn1.Location = New System.Drawing.Point(72, 24)
        Me.cboIn1.Name = "cboIn1"
        Me.cboIn1.Size = New System.Drawing.Size(184, 23)
        Me.cboIn1.TabIndex = 3
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.Location = New System.Drawing.Point(16, 92)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(27, 14)
        Me.Label5.TabIndex = 2
        Me.Label5.Text = "IN 5"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(16, 60)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(27, 14)
        Me.Label4.TabIndex = 1
        Me.Label4.Text = "IN 3"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(16, 28)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(27, 14)
        Me.Label3.TabIndex = 0
        Me.Label3.Text = "IN 1"
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.Location = New System.Drawing.Point(16, 266)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(46, 14)
        Me.Label6.TabIndex = 2
        Me.Label6.Text = "In Filter"
        '
        'cboInFilter
        '
        Me.cboInFilter.Location = New System.Drawing.Point(88, 264)
        Me.cboInFilter.Name = "cboInFilter"
        Me.cboInFilter.Size = New System.Drawing.Size(184, 23)
        Me.cboInFilter.TabIndex = 3
        '
        'Label7
        '
        Me.Label7.AutoSize = True
        Me.Label7.Location = New System.Drawing.Point(16, 298)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(56, 14)
        Me.Label7.TabIndex = 4
        Me.Label7.Text = "SD Mode"
        '
        'cboSDMode
        '
        Me.cboSDMode.Location = New System.Drawing.Point(88, 296)
        Me.cboSDMode.Name = "cboSDMode"
        Me.cboSDMode.Size = New System.Drawing.Size(184, 23)
        Me.cboSDMode.TabIndex = 5
        '
        'btnComReturn
        '
        Me.btnComReturn.Location = New System.Drawing.Point(448, 296)
        Me.btnComReturn.Name = "btnComReturn"
        Me.btnComReturn.Size = New System.Drawing.Size(88, 24)
        Me.btnComReturn.TabIndex = 7
        Me.btnComReturn.Text = "&Return"
        '
        'InOutSet
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(552, 334)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnComReturn, Me.cboSDMode, Me.Label7, Me.Label6, Me.cboInFilter, Me.GroupBox2, Me.GroupBox1})
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "InOutSet"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "InOutSetting"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
	Dim i As Short

    Private Sub cboIn1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn1.SelectedIndexChanged

        i = &H1
        If cboIn1.SelectedIndex = 1 Then
            '		CtrlIn = CtrlIn Or &H1
            CtrlIn = CtrlIn Or i
        Else
            '		CtrlIn = CtrlIn Xor &H1
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboIn2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn2.SelectedIndexChanged

        i = &H2
        If cboIn2.SelectedIndex = 1 Then
            CtrlIn = CtrlIn Or i
        Else
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboIn3_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn3.SelectedIndexChanged

        i = &H4
        If cboIn3.SelectedIndex = 1 Then
            CtrlIn = CtrlIn Or i
        Else
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboIn4_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn4.SelectedIndexChanged

        i = &H8
        If cboIn4.SelectedIndex = 1 Then
            CtrlIn = CtrlIn Or i
        Else
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboIn5_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn5.SelectedIndexChanged

        i = &H10
        If cboIn5.SelectedIndex = 1 Then
            CtrlIn = CtrlIn Or i
        Else
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboIn6_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboIn6.SelectedIndexChanged

        i = &H20
        If cboIn6.SelectedIndex = 1 Then
            CtrlIn = CtrlIn Or i
        Else
            CtrlIn = CtrlIn And (Not i)
        End If

    End Sub

    Private Sub cboInFilter_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboInFilter.SelectedIndexChanged

        FilterType = cboInFilter.SelectedIndex

    End Sub

    Private Sub cboOut1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboOut1.SelectedIndexChanged

        CtrlOut1 = cboOut1.SelectedIndex

    End Sub

    Private Sub cboOut2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboOut2.SelectedIndexChanged

        CtrlOut2 = cboOut2.SelectedIndex

    End Sub

    Private Sub cboOut3_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboOut3.SelectedIndexChanged

        CtrlOut3 = cboOut3.SelectedIndex

    End Sub

    Private Sub cboSDMode_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboSDMode.SelectedIndexChanged

        SDMode = cboSDMode.SelectedIndex

    End Sub



    Private Sub btnComReturn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnComReturn.Click

        Me.Close()

    End Sub

    Private Sub InOutSet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' OUT1 ComboBox
        cboOut1.Items.Clear()
        cboOut1.Items.Add("General-Purpose output")
        cboOut1.Items.Add("Alarm Clear")
        cboOut1.Items.Add("Counter Clear (ERC)")
        cboOut1.Items.Add("OutPulse Count Match(CP1)")
        cboOut1.Items.Add("Encoder Count Match(CP2)")
        cboOut1.Items.Add("Hold OFF")

        ' OUT2 ComboBox
        cboOut2.Items.Clear()
        cboOut2.Items.Add("General-Purpose output")
        cboOut2.Items.Add("Alarm Clear")
        cboOut2.Items.Add("Counter Clear (ERC)")
        cboOut2.Items.Add("OutPulse Count Match(CP1)")
        cboOut2.Items.Add("Encoder Count Match(CP2)")
        cboOut2.Items.Add("Hold OFF")

        ' OUT3 ComboBox
        cboOut3.Items.Clear()
        cboOut3.Items.Add("General-Purpose output")
        cboOut3.Items.Add("Alarm Clear")
        cboOut3.Items.Add("Counter Clear (ERC)")
        cboOut3.Items.Add("OutPulse Count Match(CP1)")
        cboOut3.Items.Add("Encoder Count Match(CP2)")
        cboOut3.Items.Add("Hold OFF")

        ' IN1 ComboBox
        cboIn1.Items.Clear()
        cboIn1.Items.Add("General-Purpose input")
        cboIn1.Items.Add("ALM")

        ' IN2 ComboBox
        cboIn2.Items.Clear()
        cboIn2.Items.Add("General-Purpose input")
        cboIn2.Items.Add("INP")

        ' IN3 ComboBox
        cboIn3.Items.Clear()
        cboIn3.Items.Add("General-Purpose input")
        cboIn3.Items.Add("SD")

        ' IN4 ComboBox
        cboIn4.Items.Clear()
        cboIn4.Items.Add("General-Purpose input")
        cboIn4.Items.Add("LTC")

        ' IN5 ComboBox
        cboIn5.Items.Clear()
        cboIn5.Items.Add("General-Purpose input")
        cboIn5.Items.Add("PCS")

        ' IN6 ComboBox
        cboIn6.Items.Clear()
        cboIn6.Items.Add("General-Purpose input")
        cboIn6.Items.Add("CLR")

        ' ComboBox Initialise
        cboOut1.SelectedIndex = CtrlOut1
        cboOut2.SelectedIndex = CtrlOut2
        cboOut3.SelectedIndex = CtrlOut3

        '	CtrlIn = &H3F
        If CtrlIn And &H1 Then
            cboIn1.SelectedIndex = 1
        Else
            cboIn1.SelectedIndex = 0
        End If
        If CtrlIn And &H2 Then
            cboIn2.SelectedIndex = 1
        Else
            cboIn2.SelectedIndex = 0
        End If
        If CtrlIn And &H4 Then
            cboIn3.SelectedIndex = 1
        Else
            cboIn3.SelectedIndex = 0
        End If
        If CtrlIn And &H8 Then
            cboIn4.SelectedIndex = 1
        Else
            cboIn4.SelectedIndex = 0
        End If
        If CtrlIn And &H10 Then
            cboIn5.SelectedIndex = 1
        Else
            cboIn5.SelectedIndex = 0
        End If
        If CtrlIn And &H20 Then
            cboIn6.SelectedIndex = 1
        Else
            cboIn6.SelectedIndex = 0
        End If

        ' InFilter ComboBox
        cboInFilter.Items.Clear()
        cboInFilter.Items.Add("Not Use")
        cboInFilter.Items.Add("Disregard 3.2 [usec] or less")
        cboInFilter.Items.Add("Disregard 25 [usec] or less")
        cboInFilter.Items.Add("Disregard 200 [usec] or less")
        cboInFilter.Items.Add("Disregard 1.6 [msec] or less")
        cboInFilter.SelectedIndex = FilterType

        ' SDMode ComboBox
        cboSDMode.Items.Clear()
        cboSDMode.Items.Add("Slow Down & Stop")
        cboSDMode.Items.Add("Slow Down")
        cboSDMode.SelectedIndex = SDMode

    End Sub

End Class
