Option Strict Off
Option Explicit On 

Imports VB = Microsoft.VisualBasic

Public Class ConRec
    Inherits System.Windows.Forms.Form

#Region " Windows tH[ fUCiŐꂽR[h "

    Public Sub New()
        MyBase.New()

        ' ̌Ăяo Windows tH[ fUCiŕKvłB
        InitializeComponent()

        ' InitializeComponent() Ăяǒɏǉ܂B

    End Sub

    ' Form  dispose I[o[ChăR|[lgꗗ܂B
    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

    ' Windows tH[ fUCiŕKvłB
    Private components As System.ComponentModel.IContainer

    '  : ȉ̃vV[ẂAWindows tH[ fUCiŕKvłB
    ' Windows tH[ fUCigĕύXĂB  
    ' R[h GfB^͎gpȂłB
    Public WithEvents cmdDataDel As System.Windows.Forms.Button
    Public WithEvents cmdRetDel As System.Windows.Forms.Button
    Public WithEvents Frame6 As System.Windows.Forms.GroupBox
    Public WithEvents txtTimerInterval As System.Windows.Forms.TextBox
    Public WithEvents cmdSrqRecTrigger As System.Windows.Forms.Button
    Public WithEvents optTimer As System.Windows.Forms.RadioButton
    Public WithEvents optMaxSpeed As System.Windows.Forms.RadioButton
    Public WithEvents optManual As System.Windows.Forms.RadioButton
    Public WithEvents lblTimerUnit As System.Windows.Forms.Label
    Public WithEvents Frame5 As System.Windows.Forms.GroupBox
    Public WithEvents cmdSaveCsv As System.Windows.Forms.Button
    Public WithEvents cmdEventRecStop As System.Windows.Forms.Button
    Public WithEvents cmdEventRecStart As System.Windows.Forms.Button
    Public WithEvents lstEventRec As System.Windows.Forms.ListBox
    Public WithEvents Frame4 As System.Windows.Forms.GroupBox
    Public WithEvents cmdRec As System.Windows.Forms.Button
    Public WithEvents txtRec As System.Windows.Forms.TextBox
    Public WithEvents cmdSend As System.Windows.Forms.Button
    Public WithEvents txtSend As System.Windows.Forms.TextBox
    Public WithEvents Frame3 As System.Windows.Forms.GroupBox
    Public WithEvents txtAddr As System.Windows.Forms.TextBox
    Public WithEvents cmdSearch As System.Windows.Forms.Button
    Public WithEvents cboEoi As System.Windows.Forms.ComboBox
    Public WithEvents cboDelim As System.Windows.Forms.ComboBox
    Public WithEvents cboAddr As System.Windows.Forms.ComboBox
    Public WithEvents Label5 As System.Windows.Forms.Label
    Public WithEvents Label4 As System.Windows.Forms.Label
    Public WithEvents Label3 As System.Windows.Forms.Label
    Public WithEvents Frame2 As System.Windows.Forms.GroupBox
    Public WithEvents lstRet As System.Windows.Forms.ListBox
    Public WithEvents cmdExit As System.Windows.Forms.Button
    Public WithEvents cmdInit As System.Windows.Forms.Button
    Public WithEvents Frame1 As System.Windows.Forms.GroupBox
    Public WithEvents txtMyAddr As System.Windows.Forms.TextBox
    Public WithEvents txtDevName As System.Windows.Forms.TextBox
    Public WithEvents Label2 As System.Windows.Forms.Label
    Public WithEvents Label1 As System.Windows.Forms.Label
    Public WithEvents tmrTimerEventRec As System.Windows.Forms.Timer
    Friend WithEvents sfdSaveCsv As System.Windows.Forms.SaveFileDialog
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.cmdDataDel = New System.Windows.Forms.Button()
        Me.cmdRetDel = New System.Windows.Forms.Button()
        Me.Frame6 = New System.Windows.Forms.GroupBox()
        Me.txtTimerInterval = New System.Windows.Forms.TextBox()
        Me.cmdSrqRecTrigger = New System.Windows.Forms.Button()
        Me.optTimer = New System.Windows.Forms.RadioButton()
        Me.optMaxSpeed = New System.Windows.Forms.RadioButton()
        Me.optManual = New System.Windows.Forms.RadioButton()
        Me.lblTimerUnit = New System.Windows.Forms.Label()
        Me.Frame5 = New System.Windows.Forms.GroupBox()
        Me.cmdSaveCsv = New System.Windows.Forms.Button()
        Me.cmdEventRecStop = New System.Windows.Forms.Button()
        Me.cmdEventRecStart = New System.Windows.Forms.Button()
        Me.lstEventRec = New System.Windows.Forms.ListBox()
        Me.Frame4 = New System.Windows.Forms.GroupBox()
        Me.cmdRec = New System.Windows.Forms.Button()
        Me.txtRec = New System.Windows.Forms.TextBox()
        Me.cmdSend = New System.Windows.Forms.Button()
        Me.txtSend = New System.Windows.Forms.TextBox()
        Me.Frame3 = New System.Windows.Forms.GroupBox()
        Me.txtAddr = New System.Windows.Forms.TextBox()
        Me.cmdSearch = New System.Windows.Forms.Button()
        Me.cboEoi = New System.Windows.Forms.ComboBox()
        Me.cboDelim = New System.Windows.Forms.ComboBox()
        Me.cboAddr = 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.Frame2 = New System.Windows.Forms.GroupBox()
        Me.lstRet = New System.Windows.Forms.ListBox()
        Me.cmdExit = New System.Windows.Forms.Button()
        Me.cmdInit = New System.Windows.Forms.Button()
        Me.Frame1 = New System.Windows.Forms.GroupBox()
        Me.txtMyAddr = New System.Windows.Forms.TextBox()
        Me.txtDevName = New System.Windows.Forms.TextBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.tmrTimerEventRec = New System.Windows.Forms.Timer(Me.components)
        Me.sfdSaveCsv = New System.Windows.Forms.SaveFileDialog()
        Me.Frame6.SuspendLayout()
        Me.Frame5.SuspendLayout()
        Me.Frame4.SuspendLayout()
        Me.Frame3.SuspendLayout()
        Me.Frame2.SuspendLayout()
        Me.Frame1.SuspendLayout()
        Me.SuspendLayout()
        '
        'cmdDataDel
        '
        Me.cmdDataDel.BackColor = System.Drawing.SystemColors.Control
        Me.cmdDataDel.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdDataDel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdDataDel.Location = New System.Drawing.Point(568, 168)
        Me.cmdDataDel.Name = "cmdDataDel"
        Me.cmdDataDel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdDataDel.Size = New System.Drawing.Size(113, 25)
        Me.cmdDataDel.TabIndex = 44
        Me.cmdDataDel.Text = "f[^"
        '
        'cmdRetDel
        '
        Me.cmdRetDel.BackColor = System.Drawing.SystemColors.Control
        Me.cmdRetDel.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdRetDel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdRetDel.Location = New System.Drawing.Point(568, 432)
        Me.cmdRetDel.Name = "cmdRetDel"
        Me.cmdRetDel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdRetDel.Size = New System.Drawing.Size(113, 25)
        Me.cmdRetDel.TabIndex = 43
        Me.cmdRetDel.Text = "߂l"
        '
        'Frame6
        '
        Me.Frame6.BackColor = System.Drawing.SystemColors.Control
        Me.Frame6.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtTimerInterval, Me.cmdSrqRecTrigger, Me.optTimer, Me.optMaxSpeed, Me.optManual, Me.lblTimerUnit})
        Me.Frame6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame6.Location = New System.Drawing.Point(520, 248)
        Me.Frame6.Name = "Frame6"
        Me.Frame6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame6.Size = New System.Drawing.Size(161, 145)
        Me.Frame6.TabIndex = 42
        Me.Frame6.TabStop = False
        Me.Frame6.Text = "Jn^C~Oݒ"
        '
        'txtTimerInterval
        '
        Me.txtTimerInterval.AcceptsReturn = True
        Me.txtTimerInterval.AutoSize = False
        Me.txtTimerInterval.BackColor = System.Drawing.SystemColors.Window
        Me.txtTimerInterval.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtTimerInterval.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtTimerInterval.ImeMode = System.Windows.Forms.ImeMode.Disable
        Me.txtTimerInterval.Location = New System.Drawing.Point(72, 48)
        Me.txtTimerInterval.MaxLength = 5
        Me.txtTimerInterval.Name = "txtTimerInterval"
        Me.txtTimerInterval.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtTimerInterval.Size = New System.Drawing.Size(41, 25)
        Me.txtTimerInterval.TabIndex = 31
        Me.txtTimerInterval.Text = ""
        '
        'cmdSrqRecTrigger
        '
        Me.cmdSrqRecTrigger.BackColor = System.Drawing.SystemColors.Control
        Me.cmdSrqRecTrigger.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdSrqRecTrigger.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdSrqRecTrigger.Location = New System.Drawing.Point(88, 16)
        Me.cmdSrqRecTrigger.Name = "cmdSrqRecTrigger"
        Me.cmdSrqRecTrigger.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdSrqRecTrigger.Size = New System.Drawing.Size(41, 25)
        Me.cmdSrqRecTrigger.TabIndex = 30
        Me.cmdSrqRecTrigger.Text = "gK"
        '
        'optTimer
        '
        Me.optTimer.BackColor = System.Drawing.SystemColors.Control
        Me.optTimer.Cursor = System.Windows.Forms.Cursors.Default
        Me.optTimer.ForeColor = System.Drawing.SystemColors.ControlText
        Me.optTimer.Location = New System.Drawing.Point(8, 48)
        Me.optTimer.Name = "optTimer"
        Me.optTimer.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.optTimer.Size = New System.Drawing.Size(65, 17)
        Me.optTimer.TabIndex = 29
        Me.optTimer.TabStop = True
        Me.optTimer.Text = "^C}["
        '
        'optMaxSpeed
        '
        Me.optMaxSpeed.BackColor = System.Drawing.SystemColors.Control
        Me.optMaxSpeed.Cursor = System.Windows.Forms.Cursors.Default
        Me.optMaxSpeed.ForeColor = System.Drawing.SystemColors.ControlText
        Me.optMaxSpeed.Location = New System.Drawing.Point(8, 88)
        Me.optMaxSpeed.Name = "optMaxSpeed"
        Me.optMaxSpeed.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.optMaxSpeed.Size = New System.Drawing.Size(89, 17)
        Me.optMaxSpeed.TabIndex = 28
        Me.optMaxSpeed.TabStop = True
        Me.optMaxSpeed.Text = "őXs[h"
        '
        'optManual
        '
        Me.optManual.BackColor = System.Drawing.SystemColors.Control
        Me.optManual.Checked = True
        Me.optManual.Cursor = System.Windows.Forms.Cursors.Default
        Me.optManual.ForeColor = System.Drawing.SystemColors.ControlText
        Me.optManual.Location = New System.Drawing.Point(8, 16)
        Me.optManual.Name = "optManual"
        Me.optManual.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.optManual.Size = New System.Drawing.Size(81, 15)
        Me.optManual.TabIndex = 27
        Me.optManual.TabStop = True
        Me.optManual.Text = "}jA"
        '
        'lblTimerUnit
        '
        Me.lblTimerUnit.AutoSize = True
        Me.lblTimerUnit.BackColor = System.Drawing.SystemColors.Control
        Me.lblTimerUnit.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblTimerUnit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblTimerUnit.Location = New System.Drawing.Point(120, 56)
        Me.lblTimerUnit.Name = "lblTimerUnit"
        Me.lblTimerUnit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblTimerUnit.Size = New System.Drawing.Size(33, 12)
        Me.lblTimerUnit.TabIndex = 32
        Me.lblTimerUnit.Text = "mSec"
        '
        'Frame5
        '
        Me.Frame5.BackColor = System.Drawing.SystemColors.Control
        Me.Frame5.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdSaveCsv, Me.cmdEventRecStop, Me.cmdEventRecStart, Me.lstEventRec})
        Me.Frame5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame5.Location = New System.Drawing.Point(16, 248)
        Me.Frame5.Name = "Frame5"
        Me.Frame5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame5.Size = New System.Drawing.Size(497, 145)
        Me.Frame5.TabIndex = 41
        Me.Frame5.TabStop = False
        Me.Frame5.Text = "SRQCxgMf[^"
        '
        'cmdSaveCsv
        '
        Me.cmdSaveCsv.BackColor = System.Drawing.SystemColors.Control
        Me.cmdSaveCsv.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdSaveCsv.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdSaveCsv.Location = New System.Drawing.Point(352, 88)
        Me.cmdSaveCsv.Name = "cmdSaveCsv"
        Me.cmdSaveCsv.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdSaveCsv.Size = New System.Drawing.Size(113, 33)
        Me.cmdSaveCsv.TabIndex = 26
        Me.cmdSaveCsv.Text = "Mf[^CSVt@Cŕۑ"
        '
        'cmdEventRecStop
        '
        Me.cmdEventRecStop.BackColor = System.Drawing.SystemColors.Control
        Me.cmdEventRecStop.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdEventRecStop.Enabled = False
        Me.cmdEventRecStop.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdEventRecStop.Location = New System.Drawing.Point(352, 48)
        Me.cmdEventRecStop.Name = "cmdEventRecStop"
        Me.cmdEventRecStop.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdEventRecStop.Size = New System.Drawing.Size(113, 25)
        Me.cmdEventRecStop.TabIndex = 25
        Me.cmdEventRecStop.Text = "SRQM~"
        '
        'cmdEventRecStart
        '
        Me.cmdEventRecStart.BackColor = System.Drawing.SystemColors.Control
        Me.cmdEventRecStart.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdEventRecStart.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdEventRecStart.Location = New System.Drawing.Point(352, 16)
        Me.cmdEventRecStart.Name = "cmdEventRecStart"
        Me.cmdEventRecStart.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdEventRecStart.Size = New System.Drawing.Size(113, 25)
        Me.cmdEventRecStart.TabIndex = 24
        Me.cmdEventRecStart.Text = "SRQMJn"
        '
        'lstEventRec
        '
        Me.lstEventRec.BackColor = System.Drawing.SystemColors.Window
        Me.lstEventRec.Cursor = System.Windows.Forms.Cursors.Default
        Me.lstEventRec.ForeColor = System.Drawing.SystemColors.WindowText
        Me.lstEventRec.ItemHeight = 12
        Me.lstEventRec.Location = New System.Drawing.Point(8, 16)
        Me.lstEventRec.Name = "lstEventRec"
        Me.lstEventRec.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lstEventRec.Size = New System.Drawing.Size(329, 112)
        Me.lstEventRec.TabIndex = 18
        '
        'Frame4
        '
        Me.Frame4.BackColor = System.Drawing.SystemColors.Control
        Me.Frame4.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdRec, Me.txtRec, Me.cmdSend, Me.txtSend})
        Me.Frame4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame4.Location = New System.Drawing.Point(8, 152)
        Me.Frame4.Name = "Frame4"
        Me.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame4.Size = New System.Drawing.Size(553, 81)
        Me.Frame4.TabIndex = 40
        Me.Frame4.TabStop = False
        Me.Frame4.Text = "Mf[^"
        '
        'cmdRec
        '
        Me.cmdRec.BackColor = System.Drawing.SystemColors.Control
        Me.cmdRec.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdRec.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdRec.Location = New System.Drawing.Point(432, 48)
        Me.cmdRec.Name = "cmdRec"
        Me.cmdRec.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdRec.Size = New System.Drawing.Size(113, 25)
        Me.cmdRec.TabIndex = 22
        Me.cmdRec.Text = "M(&R)"
        '
        'txtRec
        '
        Me.txtRec.AcceptsReturn = True
        Me.txtRec.AutoSize = False
        Me.txtRec.BackColor = System.Drawing.SystemColors.Window
        Me.txtRec.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtRec.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtRec.Location = New System.Drawing.Point(8, 48)
        Me.txtRec.MaxLength = 0
        Me.txtRec.Name = "txtRec"
        Me.txtRec.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtRec.Size = New System.Drawing.Size(417, 25)
        Me.txtRec.TabIndex = 21
        Me.txtRec.Text = ""
        '
        'cmdSend
        '
        Me.cmdSend.BackColor = System.Drawing.SystemColors.Control
        Me.cmdSend.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdSend.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdSend.Location = New System.Drawing.Point(432, 16)
        Me.cmdSend.Name = "cmdSend"
        Me.cmdSend.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdSend.Size = New System.Drawing.Size(113, 25)
        Me.cmdSend.TabIndex = 20
        Me.cmdSend.Text = "M(&S)"
        '
        'txtSend
        '
        Me.txtSend.AcceptsReturn = True
        Me.txtSend.AutoSize = False
        Me.txtSend.BackColor = System.Drawing.SystemColors.Window
        Me.txtSend.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtSend.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtSend.Location = New System.Drawing.Point(8, 16)
        Me.txtSend.MaxLength = 0
        Me.txtSend.Name = "txtSend"
        Me.txtSend.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtSend.Size = New System.Drawing.Size(417, 25)
        Me.txtSend.TabIndex = 19
        Me.txtSend.Text = ""
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.SystemColors.Control
        Me.Frame3.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtAddr, Me.cmdSearch, Me.cboEoi, Me.cboDelim, Me.cboAddr, Me.Label5, Me.Label4, Me.Label3})
        Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame3.Location = New System.Drawing.Point(8, 64)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(553, 81)
        Me.Frame3.TabIndex = 39
        Me.Frame3.TabStop = False
        Me.Frame3.Text = "@"
        '
        'txtAddr
        '
        Me.txtAddr.AcceptsReturn = True
        Me.txtAddr.AutoSize = False
        Me.txtAddr.BackColor = System.Drawing.SystemColors.Window
        Me.txtAddr.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtAddr.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtAddr.Location = New System.Drawing.Point(88, 16)
        Me.txtAddr.MaxLength = 0
        Me.txtAddr.Name = "txtAddr"
        Me.txtAddr.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtAddr.Size = New System.Drawing.Size(73, 18)
        Me.txtAddr.TabIndex = 36
        Me.txtAddr.Text = "Text1"
        '
        'cmdSearch
        '
        Me.cmdSearch.BackColor = System.Drawing.SystemColors.Control
        Me.cmdSearch.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdSearch.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdSearch.Location = New System.Drawing.Point(432, 48)
        Me.cmdSearch.Name = "cmdSearch"
        Me.cmdSearch.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdSearch.Size = New System.Drawing.Size(113, 25)
        Me.cmdSearch.TabIndex = 15
        Me.cmdSearch.Text = "@팟(&F)"
        '
        'cboEoi
        '
        Me.cboEoi.BackColor = System.Drawing.SystemColors.Window
        Me.cboEoi.Cursor = System.Windows.Forms.Cursors.Default
        Me.cboEoi.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboEoi.ForeColor = System.Drawing.SystemColors.WindowText
        Me.cboEoi.Items.AddRange(New Object() {"o͂Ȃ", "o͂"})
        Me.cboEoi.Location = New System.Drawing.Point(272, 48)
        Me.cboEoi.Name = "cboEoi"
        Me.cboEoi.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cboEoi.Size = New System.Drawing.Size(113, 20)
        Me.cboEoi.TabIndex = 14
        '
        'cboDelim
        '
        Me.cboDelim.BackColor = System.Drawing.SystemColors.Window
        Me.cboDelim.Cursor = System.Windows.Forms.Cursors.Default
        Me.cboDelim.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboDelim.ForeColor = System.Drawing.SystemColors.WindowText
        Me.cboDelim.Items.AddRange(New Object() {"gpȂ", "CR+LF", "CR", "LF"})
        Me.cboDelim.Location = New System.Drawing.Point(88, 48)
        Me.cboDelim.Name = "cboDelim"
        Me.cboDelim.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cboDelim.Size = New System.Drawing.Size(113, 20)
        Me.cboDelim.TabIndex = 13
        '
        'cboAddr
        '
        Me.cboAddr.BackColor = System.Drawing.SystemColors.Window
        Me.cboAddr.Cursor = System.Windows.Forms.Cursors.Default
        Me.cboAddr.ForeColor = System.Drawing.SystemColors.WindowText
        Me.cboAddr.Location = New System.Drawing.Point(176, 16)
        Me.cboAddr.Name = "cboAddr"
        Me.cboAddr.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cboAddr.Size = New System.Drawing.Size(369, 20)
        Me.cboAddr.TabIndex = 12
        '
        '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, 16)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(81, 17)
        Me.Label5.TabIndex = 11
        Me.Label5.Text = "@AhX ="
        '
        '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(224, 48)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(49, 17)
        Me.Label4.TabIndex = 10
        Me.Label4.Text = "EOI ="
        '
        '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(8, 48)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(81, 17)
        Me.Label3.TabIndex = 9
        Me.Label3.Text = "f~^ ="
        '
        'Frame2
        '
        Me.Frame2.BackColor = System.Drawing.SystemColors.Control
        Me.Frame2.Controls.AddRange(New System.Windows.Forms.Control() {Me.lstRet})
        Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame2.Location = New System.Drawing.Point(8, 400)
        Me.Frame2.Name = "Frame2"
        Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame2.Size = New System.Drawing.Size(553, 81)
        Me.Frame2.TabIndex = 38
        Me.Frame2.TabStop = False
        Me.Frame2.Text = "߂l"
        '
        'lstRet
        '
        Me.lstRet.BackColor = System.Drawing.SystemColors.Window
        Me.lstRet.Cursor = System.Windows.Forms.Cursors.Default
        Me.lstRet.ForeColor = System.Drawing.SystemColors.WindowText
        Me.lstRet.ItemHeight = 12
        Me.lstRet.Location = New System.Drawing.Point(8, 16)
        Me.lstRet.Name = "lstRet"
        Me.lstRet.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lstRet.Size = New System.Drawing.Size(537, 52)
        Me.lstRet.TabIndex = 35
        '
        'cmdExit
        '
        Me.cmdExit.BackColor = System.Drawing.SystemColors.Control
        Me.cmdExit.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdExit.Location = New System.Drawing.Point(448, 24)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdExit.Size = New System.Drawing.Size(113, 25)
        Me.cmdExit.TabIndex = 37
        Me.cmdExit.Text = "I(&X)"
        '
        'cmdInit
        '
        Me.cmdInit.BackColor = System.Drawing.SystemColors.Control
        Me.cmdInit.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdInit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdInit.Location = New System.Drawing.Point(328, 24)
        Me.cmdInit.Name = "cmdInit"
        Me.cmdInit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdInit.Size = New System.Drawing.Size(113, 25)
        Me.cmdInit.TabIndex = 0
        Me.cmdInit.Text = "(&I)"
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtMyAddr, Me.txtDevName, Me.Label2, Me.Label1})
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(8, 8)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(313, 49)
        Me.Frame1.TabIndex = 35
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "@"
        '
        'txtMyAddr
        '
        Me.txtMyAddr.AcceptsReturn = True
        Me.txtMyAddr.AutoSize = False
        Me.txtMyAddr.BackColor = System.Drawing.SystemColors.Window
        Me.txtMyAddr.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtMyAddr.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtMyAddr.Location = New System.Drawing.Point(256, 16)
        Me.txtMyAddr.MaxLength = 0
        Me.txtMyAddr.Name = "txtMyAddr"
        Me.txtMyAddr.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtMyAddr.Size = New System.Drawing.Size(33, 25)
        Me.txtMyAddr.TabIndex = 0
        Me.txtMyAddr.Text = ""
        '
        'txtDevName
        '
        Me.txtDevName.AcceptsReturn = True
        Me.txtDevName.AutoSize = False
        Me.txtDevName.BackColor = System.Drawing.SystemColors.Window
        Me.txtDevName.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtDevName.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtDevName.Location = New System.Drawing.Point(80, 16)
        Me.txtDevName.MaxLength = 0
        Me.txtDevName.Name = "txtDevName"
        Me.txtDevName.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtDevName.Size = New System.Drawing.Size(73, 25)
        Me.txtDevName.TabIndex = 2
        Me.txtDevName.Text = ""
        '
        '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(176, 24)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(81, 17)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "@AhX ="
        '
        '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(8, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(81, 17)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "foCX ="
        '
        'tmrTimerEventRec
        '
        Me.tmrTimerEventRec.Interval = 1
        '
        'sfdSaveCsv
        '
        Me.sfdSaveCsv.FileName = "doc1"
        '
        'ConRec
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.ClientSize = New System.Drawing.Size(688, 494)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdDataDel, Me.cmdRetDel, Me.Frame6, Me.Frame5, Me.Frame4, Me.Frame3, Me.Frame2, Me.cmdExit, Me.cmdInit, Me.Frame1})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "ConRec"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "ConRec"
        Me.Frame6.ResumeLayout(False)
        Me.Frame5.ResumeLayout(False)
        Me.Frame4.ResumeLayout(False)
        Me.Frame3.ResumeLayout(False)
        Me.Frame2.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private mlngRet As Integer
    Private mintDevId As Short
    Private mintEqpId(32) As Short
    Private mintSelectEqpId As Short
    Private mintAddrArray(32) As Short

    Public Const GPIB_NOTIFY_MESSAGE As Long = &H15FFS          'Message

    '**************************************************************************************************
    '   lݒ
    '**************************************************************************************************
    Private Sub ConRec_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        txtDevName.Text = "GPIB000"
        cboDelim.SelectedIndex = 1 'CR+LF
        cboEoi.SelectedIndex = 1 'o͂
        txtTimerInterval.Text = CStr(1000) '1000mSec
        txtMyAddr.Text = CStr(0)
        txtAddr.Text = CStr(0)
        txtSend.Text = "CONTEC ConRec Sample"
    End Sub

    '**************************************************************************************************
    '   Iݒ(I)
    '**************************************************************************************************
    Private Sub ConRec_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
        Call cmdExit_Click(cmdExit, New System.EventArgs())
    End Sub

    '**************************************************************************************************
    '   nꂽ߂lXg{bNXɔf܂(Tu[`)
    '   ߂lF    False(), True(ُ)
    '**************************************************************************************************
    Private Function funcSetlstRet(ByRef strRet As String) As Boolean
        Dim blnRet As Boolean
        blnRet = False '߂l

        If Len(strRet) = 0 Then '`FbN
            blnRet = True
        Else
            If lstRet.Items.Count >= 256 Then 'Xg{bNX̌Eݒ
                lstRet.Items.RemoveAt(0)
                lstRet.Items.Add(strRet)
            Else
                lstRet.Items.Add(strRet)
            End If
            lstRet.SelectedIndex = lstRet.Items.Count - 1
        End If
        funcSetlstRet = blnRet
    End Function

    '**************************************************************************************************
    '   nꂽMf[^Xg{bNXɔf܂(Tu[`)
    '   ߂lF    False(), True(ُ)
    '**************************************************************************************************
    Private Function funcSetlstSrqRecData(ByRef strRet As String) As Boolean
        Dim blnRet As Boolean
        blnRet = False '߂l

        If Len(strRet) = 0 Then '`FbN
            blnRet = True
        Else
            If lstEventRec.Items.Count >= 256 Then 'Xg{bNX̌Eݒ
                lstEventRec.Items.RemoveAt(0)
                lstEventRec.Items.Add(strRet)
            Else
                lstEventRec.Items.Add(strRet)
            End If
            lstEventRec.SelectedIndex = lstEventRec.Items.Count - 1
        End If
        funcSetlstSrqRecData = blnRet
    End Function

    '**************************************************************************************************
    '   @̐ݒ(Tu[`)
    '   @\FCNEBbvgIDEf~^EEOI̐ݒs܂
    '   ߂lF    False(), True(ُ)
    '**************************************************************************************************
    Private Function funcSetParam() As Boolean

        Dim Delim As Short
        Dim Eoi As Short
        Dim Eos As Short
        Dim strTmp As System.Text.StringBuilder

        '@킪oĂ΁AoĂ@w
        If cboAddr.Items.Count <> 0 Then
            'R{{bNXŎw肳Ă@̃CNEBbvgID擾
            mintSelectEqpId = mintEqpId(cboAddr.SelectedIndex)
        Else
            'GfBbg{bNXŎw肳Ă@AhX̃CNEBbvgID擾
            Delim = cboDelim.SelectedIndex
            mlngRet = GpibSetEquipment(mintDevId, mintSelectEqpId, Val(txtAddr.Text), 0, Delim)
            If mlngRet <> 0 Then
                'G[̏ꍇ
                strTmp = New System.Text.StringBuilder("", 256)
                Call GpibGetErrorString(mlngRet, strTmp)
                Call funcSetlstRet(strTmp.ToString)
                funcSetParam = True
                Exit Function
            End If
        End If

        'f~^R[hEOIC̐ݒ
        Delim = cboDelim.SelectedIndex
        Eoi = cboEoi.SelectedIndex
        Eos = 0
        mlngRet = GpibSetDelim(mintSelectEqpId, Delim, Eoi, Eos)
        If mlngRet <> 0 Then
            'G[̏ꍇ
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            strTmp = New System.Text.StringBuilder("u@̐ݒvI")
            Call funcSetlstRet(strTmp.ToString)
        End If

        funcSetParam = False
    End Function

    '**************************************************************************************************
    '   
    '   @\FfoCXfoCXID擾
    '**************************************************************************************************
    Private Sub cmdInit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdInit.Click
        Dim strTmp As System.Text.StringBuilder
        Dim lngData As Integer

        '֐s
        mlngRet = GpibInit(txtDevName.Text, mintDevId)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else 'ɃfoCXID擾łꍇ
            strTmp = New System.Text.StringBuilder("GpibInit : foCXID = " & mintDevId)
            Call funcSetlstRet(strTmp.ToString)
            '@AhX̎擾
            mlngRet = GpibGetStatus(mintDevId, &H8S, lngData)
            If mlngRet = 0 Then txtMyAddr.Text = CStr(lngData)
            'vpeBŃ}X^ɐݒ肳Ă邩mF
            mlngRet = GpibGetStatus(mintDevId, &HAS, lngData)
            '}X^ɐݒ肳Ă邩mF
            If (mlngRet = 0) And (lngData = 1) Then Call MsgBox("}X^ɐݒ肳Ă܂BvpeBŃ}X^ɐݒ肵ĂB", MsgBoxStyle.OKOnly)
            '\
            strTmp = New System.Text.StringBuilder("uvI")
            Call funcSetlstRet(strTmp.ToString)
        End If

        GpibSendIFC(mintDevId, 1) 'IFC𑗏o
    End Sub

    '**************************************************************************************************
    '   I
    '   @\FfoCXID𖳌ɂ
    '**************************************************************************************************
    Private Sub cmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExit.Click
        Dim strTmp As System.Text.StringBuilder

        'I֐s
        mlngRet = GpibExit(mintDevId)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        End If
        End
    End Sub

    '**************************************************************************************************
    '   @̌
    '   @\FfoCXIDɑ@ACNEBbvgID擾B
    '         ܂ACNEBbvgID̑@IEEE488.2ʃR}hu*IDN?v𑗐M
    '         @IDi[JAfԍj擾
    '**************************************************************************************************
    Private Sub cmdSearch_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSearch.Click
        Dim strTmp As System.Text.StringBuilder
        Dim intPrmAddr As Short
        Dim intScdAddr As Short
        Dim intArraySize As Short
        Dim intArrayCount As Short
        Dim lngSendLen As Integer
        Dim strSendBuf As System.Text.StringBuilder
        Dim lngRecLen As Integer
        Dim strRecBuf As System.Text.StringBuilder
        Dim EqpInforBuf As String = ""

        intPrmAddr = -1 'ꎟAhXSČ
        intScdAddr = 0 '񎟃AhXȂ
        intArraySize = 32 'z̃TCYw
        '@팟֐s
        mlngRet = GpibFindListener(mintDevId, intPrmAddr, intScdAddr, intArraySize, mintAddrArray)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
            Exit Sub
        End If
        '\
        strTmp = New System.Text.StringBuilder("GpibFindListener : o@퐔 = " & intArraySize)
        Call funcSetlstRet(strTmp.ToString)
        'R{{bNX̍ڂ
        cboAddr.Items.Clear()
        For intArrayCount = 0 To intArraySize - 1
            'CNEBbvgID擾֐s
            mlngRet = GpibSetEquipment(mintDevId, mintEqpId(intArrayCount), mintAddrArray(intArrayCount), 0, cboDelim.SelectedIndex)
            '߂l
            If mlngRet <> 0 Then
                strTmp = New System.Text.StringBuilder("", 256)
                Call GpibGetErrorString(mlngRet, strTmp)
                Call funcSetlstRet(strTmp.ToString)
            Else
                '---------------------------------------
                '@₢킹(M)
                '---------------------------------------
                strSendBuf = New System.Text.StringBuilder("*IDN?")
                lngSendLen = strSendBuf.Length
                mlngRet = GpibSendData(mintEqpId(intArrayCount), lngSendLen, strSendBuf)
                '߂l
                If mlngRet <> 0 Then
                    strTmp = New System.Text.StringBuilder("", 256)
                    Call GpibGetErrorString(mlngRet, strTmp)
                    Call funcSetlstRet(strTmp.ToString)
                Else
                    '---------------------------------------
                    '@₢킹(M)
                    '---------------------------------------
                    strRecBuf = New System.Text.StringBuilder("", 256)
                    lngRecLen = 256 'Mobt@TCYw
                    mlngRet = GpibRecData(mintEqpId(intArrayCount), lngRecLen, strRecBuf)
                    strRecBuf.Length = lngRecLen
                    '߂l
                    If mlngRet <> 0 Then
                        strTmp = New System.Text.StringBuilder("", 256)
                        Call GpibGetErrorString(mlngRet, strTmp)
                        Call funcSetlstRet(strTmp.ToString)
                    Else
                        '---------------------------------------
                        'Mf[^IEEE488.2KimF
                        '---------------------------------------
                        If InStr(1, strRecBuf.ToString, ",", CompareMethod.Text) > 0 Then
                            'AhX
                            EqpInforBuf = "Address:" & mintAddrArray(intArrayCount) & strRecBuf.ToString
                        Else
                            'Mf[^IEEE488.2KiłȂꍇAAhX̂
                            EqpInforBuf = "Address:" & mintAddrArray(intArrayCount)
                        End If
                    End If
                    'Xgɒǉ
                    cboAddr.Items.Insert(intArrayCount, EqpInforBuf)
                    cboAddr.SelectedIndex = intArrayCount
                End If
            End If
        Next intArrayCount
        '\
        strTmp = New System.Text.StringBuilder("u@̌vI")
        Call funcSetlstRet(strTmp.ToString)
        If cboAddr.SelectedIndex <> -1 Then
            txtAddr.Text = CStr(Val(CStr(mintAddrArray(cboAddr.SelectedIndex))))
        End If

    End Sub

    '**************************************************************************************************
    '   f[^̑M
    '   @\FX[u@Ƀf[^𑗐M
    '**************************************************************************************************
    Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
        Dim strTmp As System.Text.StringBuilder
        Dim lngSendLen As Integer
        Dim strSendBuf As System.Text.StringBuilder
        '@̐ݒ
        If funcSetParam() = True Then Exit Sub

        strSendBuf = New System.Text.StringBuilder(txtSend.Text)
        lngSendLen = strSendBuf.Length
        If lngSendLen = 0 Then
            strTmp = New System.Text.StringBuilder("GpibSendData : Mf[^܂")
            Call funcSetlstRet(strTmp.ToString)
            Exit Sub
        End If
        strTmp = New System.Text.StringBuilder("GpibSendData : M...")
        Call funcSetlstRet(strTmp.ToString)
        'Ms
        mlngRet = GpibSendData(mintSelectEqpId, lngSendLen, strSendBuf)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            '\
            strTmp = New System.Text.StringBuilder("GpibSendData : Mf[^ = " & lngSendLen)
            Call funcSetlstRet(strTmp.ToString)
            strTmp = New System.Text.StringBuilder("uf[^̑MvI")
            Call funcSetlstRet(strTmp.ToString)
        End If
    End Sub

    '**************************************************************************************************
    '   f[^̎M
    '   @\FX[u@킩f[^M
    '**************************************************************************************************
    Private Sub cmdRec_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdRec.Click
        Dim strTmp As System.Text.StringBuilder
        Dim lngRecLen As Integer
        Dim strRecBuf As System.Text.StringBuilder
        '@̐ݒ
        If funcSetParam() = True Then Exit Sub
        strTmp = New System.Text.StringBuilder("GpibRecData : M...")
        Call funcSetlstRet(strTmp.ToString)
        strRecBuf = New System.Text.StringBuilder("", 256)
        lngRecLen = 256
        'Ms
        mlngRet = GpibRecData(mintSelectEqpId, lngRecLen, strRecBuf)
        strRecBuf.Length = lngRecLen
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            '\
            strRecBuf.Length = lngRecLen
            txtRec.Text = strRecBuf.ToString  'Mf[^\
            strTmp = New System.Text.StringBuilder("GpibRecData : Mf[^ = " & lngRecLen)
            Call funcSetlstRet(strTmp.ToString)
            strTmp = New System.Text.StringBuilder("uf[^̎MvI")
            Call funcSetlstRet(strTmp.ToString)
        End If
    End Sub
    '**************************************************************************************************
    '   MeLXgf[^ECxgMf[^
    '**************************************************************************************************
    Private Sub cmdDataDel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdDataDel.Click
        txtSend.Text = ""
        txtRec.Text = ""
        lstEventRec.Items.Clear()
    End Sub

    '**************************************************************************************************
    '   ߂lf[^
    '**************************************************************************************************
    Private Sub cmdRetDel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdRetDel.Click
        lstRet.Items.Clear()
    End Sub

    '**************************************************************************************************
    '   }jA^C~O̊Jn
    '   @\FGETR}h𑗐M
    '         @ɂĂGETR}hł͐ɓ삵Ȃꍇ܂̂
    '         @̎dlɂ킹ĕύXĂ
    '**************************************************************************************************
    Private Sub cmdSrqRecTrigger_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSrqRecTrigger.Click
        Dim strTmp As System.Text.StringBuilder
        '@̐ݒ
        If funcSetParam() = True Then Exit Sub
        'GETR}hM֐̎s
        mlngRet = GpibSendTrigger(mintSelectEqpId)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            '\
            strTmp = New System.Text.StringBuilder("uGETR}h̑MvI")
            Call funcSetlstRet(strTmp.ToString)
        End If
    End Sub

    '**************************************************************************************************
    '   SRQCxgMJn
    '   @\FSRQLɂȂꍇMs
    '**************************************************************************************************
    Private Sub cmdEventRecStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdEventRecStart.Click
        Dim strTmp As System.Text.StringBuilder

        '^C}[CxgIĂ΃^C}CxgJn
        If optTimer.Checked = True Then
            tmrTimerEventRec.Interval = Val(txtTimerInterval.Text)
            tmrTimerEventRec.Enabled = True
        End If
        'őXs[hIĂΊJns
        If optMaxSpeed.Checked = True Then Call cmdSrqRecTrigger_Click(cmdSrqRecTrigger, New System.EventArgs())
        'Cxgݒ֐̎s
        mlngRet = GpibSetNotifySignal(mintDevId, Handle.ToInt32, &H20S)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            cmdEventRecStop.Enabled = True
            cmdEventRecStart.Enabled = False
            '\
            strTmp = New System.Text.StringBuilder("uSRQCxgMJnvI")
            Call funcSetlstRet(strTmp.ToString)
        End If
    End Sub
    '**************************************************************************************************
    '   SRQCxgM~
    '   @\FCxgM~
    '**************************************************************************************************
    Private Sub cmdEventRecStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdEventRecStop.Click
        Dim strTmp As System.Text.StringBuilder

        '^C}[CxgsȂ^C}Cxg~
        If tmrTimerEventRec.Enabled = True Then tmrTimerEventRec.Enabled = False
        'Cxgݒ֐̎s
        mlngRet = GpibSetNotifySignal(mintDevId, Handle.ToInt32, 0)
        '߂l
        If mlngRet <> 0 Then
            strTmp = New System.Text.StringBuilder("", 256)
            Call GpibGetErrorString(mlngRet, strTmp)
            Call funcSetlstRet(strTmp.ToString)
        Else
            cmdEventRecStop.Enabled = False
            cmdEventRecStart.Enabled = True
            '\
            strTmp = New System.Text.StringBuilder("uSRQCxgM~vI")
            Call funcSetlstRet(strTmp.ToString)
        End If
    End Sub

    '**************************************************************************************************
    '   Mf[^CSVt@Cŕۑ
    '**************************************************************************************************
    Private Sub cmdSaveCsv_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSaveCsv.Click
        Dim strFileDataBuf As String
        Dim i As Short

        'Xg{bNXɃf[^邩`FbN
        If lstEventRec.Items.Count = 0 Then
            Call MsgBox("Mf[^܂", MsgBoxStyle.OKOnly)
        Else
            sfdSaveCsv.FileName = "ConRec.csv" 'ftHgt@C
            sfdSaveCsv.DefaultExt = "csv"
            'sfdSaveCsv.Title = "Mf[^ۑ"  '_CAO^Cg
            sfdSaveCsv.InitialDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)  'ŏɊJtH_AvP[VpXɐݒ
            sfdSaveCsv.OverwritePrompt = True '㏑mF
            sfdSaveCsv.Filter = "csvt@C(*.csv)|*.csv|All files (*.*)|*.*"
            On Error GoTo cmdSaveCsvEnd
            '_CAO\
            sfdSaveCsv.ShowDialog()
            FileOpen(1, sfdSaveCsv.FileName, OpenMode.Output, OpenAccess.Write)
            't@CɃf[^
            strFileDataBuf = "M,Mf[^"
            PrintLine(1, Trim(strFileDataBuf))
            For i = 0 To lstEventRec.Items.Count - 1
                strFileDataBuf = i & "," & lstEventRec.Items.Item(i) & vbCrLf
                PrintLine(1, strFileDataBuf)
            Next i
            't@C
            FileClose(1)
        End If
cmdSaveCsvEnd:
    End Sub

    '**************************************************************************************************
    '   ^C}CxgJn
    '   @\FԊuŊJns
    '**************************************************************************************************
    Private Sub tmrTimerEventRec_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrTimerEventRec.Tick

        Call cmdSrqRecTrigger_Click(cmdSrqRecTrigger, New System.EventArgs())

    End Sub

    '**************************************************************************************************
    '   SRQCxgM
    '   @\FSRQCLɂȂꍇɃVA|[EMs
    '**************************************************************************************************
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Dim intStb As Short
        Dim strTmp As System.Text.StringBuilder
        Dim intSrqLine As Short
        Dim lngRecLen As Integer
        Dim strRecBuf As System.Text.StringBuilder

        '----------------------------------------
        '   SRQMꍇ̏
        '----------------------------------------
        If (m.Msg = GPIB_NOTIFY_MESSAGE) Then
            If (m.WParam.ToInt32 And &H20S) <> 0 Then
                'Equipent IDEf~^EEOI̐ݒ
                If funcSetParam() = True Then GoTo cmsNotifySignalEventEnd
                'VA|[֐̎s
                strTmp = New System.Text.StringBuilder("GpibSPoll : VA|[...")
                Call funcSetlstRet(strTmp.ToString)
                'VA|[֐̎s
                mlngRet = GpibSPoll(mintSelectEqpId, intStb, intSrqLine)
                '߂l
                If mlngRet <> 0 Then
                    strTmp = New System.Text.StringBuilder("", 256)
                    Call GpibGetErrorString(mlngRet, strTmp)
                    Call funcSetlstRet(strTmp.ToString)
                    Exit Sub
                End If
                strTmp = New System.Text.StringBuilder("GpibSPoll : Xe[^XoCg = " & VB.Right("0" & Hex(intStb), 2) & "(H) SRQ C = " & VB.Right("0" & Hex(intSrqLine), 2) & "(H)")
                Call funcSetlstRet(strTmp.ToString)
                strTmp = New System.Text.StringBuilder("uVA|[̎svI")
                Call funcSetlstRet(strTmp.ToString)

                'f[^M
                strRecBuf = New System.Text.StringBuilder("", 256)
                lngRecLen = 256 'Mobt@TCYw
                strTmp = New System.Text.StringBuilder("GpibRecData : M...")
                Call funcSetlstRet(strTmp.ToString)
                'Ms
                mlngRet = GpibRecData(mintSelectEqpId, lngRecLen, strRecBuf)
                strRecBuf.Length = lngRecLen
                '߂l
                If mlngRet <> 0 Then
                    strTmp = New System.Text.StringBuilder("", 256)
                    Call GpibGetErrorString(mlngRet, strTmp)
                    Call funcSetlstRet(strTmp.ToString)
                    cmdEventRecStop_Click(cmdEventRecStop, New System.EventArgs())
                    Exit Sub
                End If
                '   f[^\
                strRecBuf.Length = lngRecLen
                funcSetlstSrqRecData(strRecBuf.ToString) 'Mf[^Xgɕ\
                strTmp = New System.Text.StringBuilder("GpibRecData : Mf[^ = " & lngRecLen)
                funcSetlstRet(strTmp.ToString) 'Xgɕ\
                strTmp = New System.Text.StringBuilder("uf[^̎MvI")
                funcSetlstRet(strTmp.ToString) 'Xgɕ\

                'őXs[hIĂ΃gKs
                If optMaxSpeed.Checked = True Then Call cmdSrqRecTrigger_Click(cmdSrqRecTrigger, New System.EventArgs())
            End If
cmsNotifySignalEventEnd:
            '----------------------------------------
            '   ēxCxg҂ݒ
            '----------------------------------------
            'Cxgݒ֐̎s
            mlngRet = GpibSetNotifySignal(mintDevId, Handle.ToInt32, &H20S)
            '߂l
            If mlngRet <> 0 Then
                strTmp = New System.Text.StringBuilder("", 256)
                Call GpibGetErrorString(mlngRet, strTmp)
                Call funcSetlstRet(strTmp.ToString)
            End If
        End If

        MyBase.WndProc(m)
    End Sub

    '**************************************************************************************************
    '   ͋K(̂)
    '**************************************************************************************************
    Private Sub txtTimerInterval_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtTimerInterval.KeyPress
        Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
        If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> System.Windows.Forms.Keys.Back Then
            KeyAscii = 0
        End If
        If KeyAscii = 0 Then
            eventArgs.Handled = True
        End If
    End Sub

End Class
