Option Strict Off
Option Explicit On
Imports System.Text
Friend Class Form1
	Inherits System.Windows.Forms.Form
#Region "Windows tH[ fUCiɂĐꂽR[h"
	Public Sub New()
		MyBase.New()
		'̌ĂяóAWindows tH[ fUCiŕKvłB
		InitializeComponent()
	End Sub
	'Form ́AR|[lgꗗɌ㏈s邽߂ dispose I[o[Ch܂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
	Public WithEvents CommandSetting As System.Windows.Forms.Button
	Public WithEvents TextDevice As System.Windows.Forms.TextBox
	Public WithEvents CommandInit As System.Windows.Forms.Button
	Public WithEvents CommandStart As System.Windows.Forms.Button
	Public WithEvents CommandInfo As System.Windows.Forms.Button
	Public WithEvents CommandStop As System.Windows.Forms.Button
	Public WithEvents CommandExit As System.Windows.Forms.Button
	Public WithEvents ListData As System.Windows.Forms.ListBox
	Public WithEvents TextInfo As System.Windows.Forms.TextBox
	Public WithEvents LabelCountJudge As System.Windows.Forms.Label
	Public WithEvents Label2 As System.Windows.Forms.Label
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Label3 As System.Windows.Forms.Label
	Public WithEvents Label6 As System.Windows.Forms.Label
	Public WithEvents LabelStatus As System.Windows.Forms.Label
	' : ȉ̃vV[W Windows tH[ fUCiŕKvłB
	'Windows tH[ fUCigĕύXł܂B
	'R[hGfB^gďCȂłB


	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Me.CommandSetting = New System.Windows.Forms.Button()
		Me.TextDevice = New System.Windows.Forms.TextBox()
		Me.CommandInit = New System.Windows.Forms.Button()
		Me.CommandStart = New System.Windows.Forms.Button()
		Me.CommandInfo = New System.Windows.Forms.Button()
		Me.CommandStop = New System.Windows.Forms.Button()
		Me.CommandExit = New System.Windows.Forms.Button()
		Me.ListData = New System.Windows.Forms.ListBox()
		Me.TextInfo = New System.Windows.Forms.TextBox()
		Me.LabelCountJudge = New System.Windows.Forms.Label()
		Me.Label2 = New System.Windows.Forms.Label()
		Me.Label1 = New System.Windows.Forms.Label()
		Me.Label3 = New System.Windows.Forms.Label()
		Me.Label6 = New System.Windows.Forms.Label()
		Me.LabelStatus = New System.Windows.Forms.Label()
		Me.SuspendLayout()
		'
		'CommandSetting
		'
		Me.CommandSetting.BackColor = System.Drawing.SystemColors.Control
		Me.CommandSetting.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandSetting.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandSetting.Location = New System.Drawing.Point(8, 88)
		Me.CommandSetting.Name = "CommandSetting"
		Me.CommandSetting.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandSetting.Size = New System.Drawing.Size(89, 25)
		Me.CommandSetting.TabIndex = 14
		Me.CommandSetting.Text = "ݒ"
		'
		'TextDevice
		'
		Me.TextDevice.AcceptsReturn = True
		Me.TextDevice.AutoSize = False
		Me.TextDevice.BackColor = System.Drawing.SystemColors.Window
		Me.TextDevice.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.TextDevice.ForeColor = System.Drawing.SystemColors.WindowText
		Me.TextDevice.Location = New System.Drawing.Point(8, 32)
		Me.TextDevice.MaxLength = 0
		Me.TextDevice.Name = "TextDevice"
		Me.TextDevice.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.TextDevice.Size = New System.Drawing.Size(89, 18)
		Me.TextDevice.TabIndex = 7
		Me.TextDevice.Text = "DIG000"
		'
		'CommandInit
		'
		Me.CommandInit.BackColor = System.Drawing.SystemColors.Control
		Me.CommandInit.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandInit.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandInit.Location = New System.Drawing.Point(8, 56)
		Me.CommandInit.Name = "CommandInit"
		Me.CommandInit.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandInit.Size = New System.Drawing.Size(89, 25)
		Me.CommandInit.TabIndex = 6
		Me.CommandInit.Text = ""
		'
		'CommandStart
		'
		Me.CommandStart.BackColor = System.Drawing.SystemColors.Control
		Me.CommandStart.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandStart.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandStart.Location = New System.Drawing.Point(8, 120)
		Me.CommandStart.Name = "CommandStart"
		Me.CommandStart.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandStart.Size = New System.Drawing.Size(89, 25)
		Me.CommandStart.TabIndex = 5
		Me.CommandStart.Text = "Jn"
		'
		'CommandInfo
		'
		Me.CommandInfo.BackColor = System.Drawing.SystemColors.Control
		Me.CommandInfo.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandInfo.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandInfo.Location = New System.Drawing.Point(8, 152)
		Me.CommandInfo.Name = "CommandInfo"
		Me.CommandInfo.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandInfo.Size = New System.Drawing.Size(89, 25)
		Me.CommandInfo.TabIndex = 4
		Me.CommandInfo.Text = "Ԏ擾"
		'
		'CommandStop
		'
		Me.CommandStop.BackColor = System.Drawing.SystemColors.Control
		Me.CommandStop.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandStop.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandStop.Location = New System.Drawing.Point(8, 184)
		Me.CommandStop.Name = "CommandStop"
		Me.CommandStop.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandStop.Size = New System.Drawing.Size(89, 25)
		Me.CommandStop.TabIndex = 3
		Me.CommandStop.Text = "~"
		'
		'CommandExit
		'
		Me.CommandExit.BackColor = System.Drawing.SystemColors.Control
		Me.CommandExit.Cursor = System.Windows.Forms.Cursors.Default
		Me.CommandExit.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CommandExit.Location = New System.Drawing.Point(8, 216)
		Me.CommandExit.Name = "CommandExit"
		Me.CommandExit.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CommandExit.Size = New System.Drawing.Size(89, 25)
		Me.CommandExit.TabIndex = 2
		Me.CommandExit.Text = "I"
		'
		'ListData
		'
		Me.ListData.BackColor = System.Drawing.SystemColors.Window
		Me.ListData.Cursor = System.Windows.Forms.Cursors.Default
		Me.ListData.ForeColor = System.Drawing.SystemColors.WindowText
		Me.ListData.ItemHeight = 12
		Me.ListData.Location = New System.Drawing.Point(112, 32)
		Me.ListData.Name = "ListData"
		Me.ListData.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.ListData.Size = New System.Drawing.Size(273, 208)
		Me.ListData.TabIndex = 1
		'
		'TextInfo
		'
		Me.TextInfo.AcceptsReturn = True
		Me.TextInfo.AutoSize = False
		Me.TextInfo.BackColor = System.Drawing.SystemColors.Window
		Me.TextInfo.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.TextInfo.ForeColor = System.Drawing.SystemColors.WindowText
		Me.TextInfo.Location = New System.Drawing.Point(8, 272)
		Me.TextInfo.MaxLength = 0
		Me.TextInfo.Name = "TextInfo"
		Me.TextInfo.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.TextInfo.Size = New System.Drawing.Size(377, 25)
		Me.TextInfo.TabIndex = 0
		Me.TextInfo.Text = ""
		'
		'LabelCountJudge
		'
		Me.LabelCountJudge.BackColor = System.Drawing.SystemColors.Control
		Me.LabelCountJudge.Cursor = System.Windows.Forms.Cursors.Default
		Me.LabelCountJudge.ForeColor = System.Drawing.SystemColors.ControlText
		Me.LabelCountJudge.Location = New System.Drawing.Point(144, 248)
		Me.LabelCountJudge.Name = "LabelCountJudge"
		Me.LabelCountJudge.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.LabelCountJudge.Size = New System.Drawing.Size(57, 17)
		Me.LabelCountJudge.TabIndex = 13
		Me.LabelCountJudge.Text = "0"
		'
		'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(8, 248)
		Me.Label2.Name = "Label2"
		Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label2.Size = New System.Drawing.Size(113, 17)
		Me.Label2.TabIndex = 12
		Me.Label2.Text = "R[h茋"
		'
		'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, 8)
		Me.Label1.Name = "Label1"
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.Size = New System.Drawing.Size(65, 17)
		Me.Label1.TabIndex = 11
		Me.Label1.Text = "foCX"
		'
		'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(112, 8)
		Me.Label3.Name = "Label3"
		Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label3.Size = New System.Drawing.Size(272, 17)
		Me.Label3.TabIndex = 10
		Me.Label3.Text = "JEg    f[^                 茋ʏڍ"
		'
		'Label6
		'
		Me.Label6.BackColor = System.Drawing.SystemColors.Control
		Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label6.Location = New System.Drawing.Point(208, 248)
		Me.Label6.Name = "Label6"
		Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label6.Size = New System.Drawing.Size(57, 17)
		Me.Label6.TabIndex = 9
		Me.Label6.Text = "Xe[^X"
		'
		'LabelStatus
		'
		Me.LabelStatus.BackColor = System.Drawing.SystemColors.Control
		Me.LabelStatus.Cursor = System.Windows.Forms.Cursors.Default
		Me.LabelStatus.ForeColor = System.Drawing.SystemColors.ControlText
		Me.LabelStatus.Location = New System.Drawing.Point(288, 248)
		Me.LabelStatus.Name = "LabelStatus"
		Me.LabelStatus.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.LabelStatus.Size = New System.Drawing.Size(57, 17)
		Me.LabelStatus.TabIndex = 8
		Me.LabelStatus.Text = "0H"
		'
		'Form1
		'
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
		Me.ClientSize = New System.Drawing.Size(393, 307)
		Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CommandSetting, Me.TextDevice, Me.CommandInit, Me.CommandStart, Me.CommandInfo, Me.CommandStop, Me.CommandExit, Me.ListData, Me.TextInfo, Me.LabelCountJudge, Me.Label2, Me.Label1, Me.Label3, Me.Label6, Me.LabelStatus})
		Me.Location = New System.Drawing.Point(4, 30)
		Me.MaximizeBox = False
		Me.Name = "Form1"
		Me.Text = "g`@2"
		Me.ResumeLayout(False)

	End Sub
#End Region 
	Dim Id As Short ' foCXID
	Const MAX_SAMPLES As Short = 512 ' őTvO
	Dim Data(MAX_SAMPLES) As Single ' 擾f[^̔z
	Dim Judge(MAX_SAMPLES) As Short ' g`茋
	Dim JudgeDetail(MAX_SAMPLES) As Short ' g`茋ʏڍ
	Dim UpperData(MAX_SAMPLES) As Single ' g`f[^̔z
	Dim LowerData(MAX_SAMPLES) As Single ' g`艺f[^̔z
	Dim Records As Integer ' 擾R[h
	
	'==================================
	' 
	'==================================
	Private Sub CommandInit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandInit.Click
		Dim Ret As Integer ' ߂l
		Dim Ret2 As Integer ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[

		'----------------------------------
		' 
		'----------------------------------
		Ret = DigInit(TextDevice.Text, Id)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigInit = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' foCX̃Zbg
		'----------------------------------
		Ret = DigResetDevice(Id)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigResetDevice = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		TextInfo.Text = " : I"
	End Sub

	'==================================
	' foCXݒ
	'==================================
	Private Sub CommandSetting_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandSetting.Click
		Dim Ret As Integer		  ' ߂l
		Dim Ret2 As Integer		  ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[

		'----------------------------------
		' 샂[hݒFg`@[h
		'----------------------------------
		Ret = DigSetDigitizerMode(Id, DIG_MODE_JUDGE)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetDigitizerMode = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' TvONbN\[XݒF{[hU@
		'----------------------------------
		Ret = DigSetClockSource(Id, DIG_ECU_SRC_CLOCK)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetClockSource = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' TvO[gݒF1MHz
		'----------------------------------
		Ret = DigSetSampleRate(Id, 1000000)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetSampleRate = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' R[hݒF512Tv
		'----------------------------------
		Ret = DigSetRecordLength(Id, MAX_SAMPLES)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetRecordLength = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' R[hW񐔐ݒF1
		'----------------------------------
		Ret = DigSetRecordNumber(Id, 1)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetRecordNumber = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' f[eBݒF50%
		'----------------------------------
		Ret = DigSetDutyCycle(Id, 50)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetDutyCycle = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' `lݒF0`l̂ݗL
		'----------------------------------
		' 0`lLɂ
		Ret = DigSetChannel(Id, DIG_CHANNEL0, DIG_ENABLE)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetChannel = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		' 1`l𖳌ɂ
		Ret = DigSetChannel(Id, DIG_CHANNEL1, DIG_DISABLE)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetChannel = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' WݒF}20V
		'----------------------------------
		Ret = DigSetRange(Id, DIG_CHANNEL0, DIG_RANGE_40VPP)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetRange = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' vgKނ̐ݒF
		'----------------------------------
		Ret = DigSetPreTriggerType(Id, DIG_TRIGGERTYPE_AUTO)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetPreTriggerType = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' |XggKނ̐ݒFAiOGbWgK
		'----------------------------------
		Ret = DigSetPostTriggerType(Id, DIG_TRIGGERTYPE_AIEDGE)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetPostTriggerType = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' |XggK̏ڍאݒFgKM0`lAgKx0VAGbWA1
		'----------------------------------
		Ret = DigSetPostTriggerAiEdge(Id, DIG_CHANNEL0, 0, DIG_TRIGGER_SLOPE_RISE, 1)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetPostTriggerAiEdge = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' g`s`lݒF0`l
		'----------------------------------
		Ret = DigSetJudgeChannel(Id, DIG_CHANNEL0, DIG_ENABLE)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetJudgeChannel = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' g`茋ʂ̃JEg񐔂ݒFs񐔂JEgAJEg1
		'----------------------------------
		Ret = DigSetJudgeCountLimit(Id, DIG_CHANNEL0, DIG_JUDGE_NG, 1)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetJudgeCountLimit = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' g`p̃f[^ݒF+5VA-5V
		'----------------------------------
		Dim i As Integer
		For i = 0 To MAX_SAMPLES - 1
			UpperData(i) = 5
			LowerData(i) = -5
		Next
        Ret = DigSetJudgeData(Id, DIG_CHANNEL0, MAX_SAMPLES, UpperData, LowerData)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigSetJudgeData = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		' ۂɐݒ肳ꂽf[^̎擾
        Ret = DigGetJudgeData(Id, DIG_CHANNEL0, MAX_SAMPLES, UpperData, LowerData)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigGetJudgeData = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		TextInfo.Text = "foCXݒFI"
	End Sub


	'==================================
	' WJn
	'==================================
	Private Sub CommandStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandStart.Click
		Dim Ret As Integer		  ' ߂l
		Dim Ret2 As Integer		  ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[

		'----------------------------------
		' ϐ
		'----------------------------------
		Records = 0
		ListData.Items.Clear()

		'----------------------------------
		' Jn
		'----------------------------------
		Ret = DigStart(Id)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigStart = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If
		TextInfo.Text = "Jn : I"

		'----------------------------------
		' 쒆Xe[^XOFFɂȂ܂Ń|[O
		'----------------------------------
		Dim Status As Integer

		Do
			System.Windows.Forms.Application.DoEvents()			 ' _CAOLɂ邽߂̏
			'----------------------------------
			' Xe[^X̎擾
			'----------------------------------
			Ret = DigGetStatus(Id, Status)
			If Ret <> 0 Then
				Ret2 = DigGetErrorString(Ret, ErrorString)
                TextInfo.Text = "DigGetStatus = " & Ret & " : " & ErrorString.ToString()
				Exit Sub
			End If
			LabelStatus.Text = Hex(Status) & "H"
		Loop While (Status And DIG_STATUS_BUSY) = DIG_STATUS_BUSY

		'----------------------------------
		' ~ɃhCoɊi[Ă郌R[h擾
		'----------------------------------
		Ret = DigGetDriverMemoryRecords(Id, Records)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigGetDriverMemoryRecords = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' Wf[^擾FVf[^1R[h̃f[^擾
		'----------------------------------
		' hCoɎWR[h̃f[^݂ȂꍇAf[^擾܂B
		If Records <= 0 Then
			TextInfo.Text = "Wf[^݂܂B"
			Exit Sub
		End If

        Ret = DigReadLatestRecords(Id, DIG_RECORD_ALL, 1, Data, Judge, JudgeDetail)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigReadEarliestRecords = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		'----------------------------------
		' 茋ʂ\
		'----------------------------------
		LabelCountJudge.Text = CStr(Judge(0))
		Dim i As Integer
		For i = 0 To MAX_SAMPLES - 1
			ListData.Items.Add(i + 1 & vbTab & String.Format("{0:F3}", Data(i)) & vbTab & String.Format("{0:F3}", UpperData(i)) & vbTab & String.Format("{0:F3}", LowerData(i)) & vbTab & JudgeDetail(i))
		Next i

	End Sub

	'==================================
	' Ԏ擾
	'==================================
	Private Sub CommandInfo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandInfo.Click
		Dim Ret As Integer		  ' ߂l
		Dim Ret2 As Integer		  ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[
		Dim Status As Integer		  ' Xe[^X

		'----------------------------------
		' Xe[^X̎擾
		'----------------------------------
		Ret = DigGetStatus(Id, Status)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigGetStatus = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If
		LabelStatus.Text = Hex(Status) & "H"

		TextInfo.Text = "Ԏ擾 : I"
	End Sub

	'==================================
	' W~
	'==================================
	Private Sub CommandStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandStop.Click
		Dim Ret As Integer		  ' ߂l
		Dim Ret2 As Integer		  ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[

		Ret = DigStop(Id)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigExit = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		TextInfo.Text = "W~ : I"
	End Sub

	'==================================
	' I
	'==================================
	Private Sub CommandExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CommandExit.Click
		Dim Ret As Integer		  ' ߂l
		Dim Ret2 As Integer		  ' ߂l2
        Dim ErrorString As New StringBuilder("", 256)     ' G[

		Ret = DigExit(Id)
		If Ret <> 0 Then
			Ret2 = DigGetErrorString(Ret, ErrorString)
            TextInfo.Text = "DigExit = " & Ret & " : " & ErrorString.ToString()
			Exit Sub
		End If

		TextInfo.Text = "I : I"
	End Sub

	'==================================
	' tH[̃A[h
	'==================================
	Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
		Dim Ret As Integer		  ' ߂l
		Ret = DigExit(Id)
	End Sub
End Class