﻿Option Strict Off
Option Explicit On 
Imports System.Globalization
Imports System.Text

Public Class ConditionDlg
	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.
	Public WithEvents btnCancel As System.Windows.Forms.Button
	Public WithEvents Frame4 As System.Windows.Forms.GroupBox
	Public WithEvents txtNumEvent As System.Windows.Forms.TextBox
	Public WithEvents Label11 As System.Windows.Forms.Label
	Public WithEvents btnOK As System.Windows.Forms.Button
	Public WithEvents Frame2 As System.Windows.Forms.GroupBox
	Public WithEvents rdoStartCntWithSamp As System.Windows.Forms.RadioButton
	Public WithEvents rdoStartCntNotWithSamp As System.Windows.Forms.RadioButton
	Public WithEvents Frame3 As System.Windows.Forms.GroupBox
	Public WithEvents rdoStopCntWithSamp As System.Windows.Forms.RadioButton
	Public WithEvents rdoStopCntNotWithSamp As System.Windows.Forms.RadioButton
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents cboClockTrg As System.Windows.Forms.ComboBox
	Public WithEvents cboStopTrg As System.Windows.Forms.ComboBox
	Public WithEvents txtStopNum As System.Windows.Forms.TextBox
	Public WithEvents txtCompStop As System.Windows.Forms.TextBox
	Public WithEvents txtInternalClock As System.Windows.Forms.TextBox
	Public WithEvents txtCompStart As System.Windows.Forms.TextBox
	Public WithEvents cboStartTrg As System.Windows.Forms.ComboBox
	Public WithEvents Label10 As System.Windows.Forms.Label
	Public WithEvents Label9 As System.Windows.Forms.Label
	Public WithEvents Label8 As System.Windows.Forms.Label
	Public WithEvents Label7 As System.Windows.Forms.Label
	Public WithEvents Label6 As System.Windows.Forms.Label
	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 Label2 As System.Windows.Forms.Label
	Public WithEvents Label1 As System.Windows.Forms.Label
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Me.btnCancel = New System.Windows.Forms.Button()
		Me.Frame4 = New System.Windows.Forms.GroupBox()
		Me.txtNumEvent = New System.Windows.Forms.TextBox()
		Me.Label11 = New System.Windows.Forms.Label()
		Me.btnOK = New System.Windows.Forms.Button()
		Me.Frame2 = New System.Windows.Forms.GroupBox()
		Me.rdoStartCntWithSamp = New System.Windows.Forms.RadioButton()
		Me.rdoStartCntNotWithSamp = New System.Windows.Forms.RadioButton()
		Me.Frame3 = New System.Windows.Forms.GroupBox()
		Me.rdoStopCntWithSamp = New System.Windows.Forms.RadioButton()
		Me.rdoStopCntNotWithSamp = New System.Windows.Forms.RadioButton()
		Me.Frame1 = New System.Windows.Forms.GroupBox()
		Me.cboClockTrg = New System.Windows.Forms.ComboBox()
		Me.cboStopTrg = New System.Windows.Forms.ComboBox()
		Me.txtStopNum = New System.Windows.Forms.TextBox()
		Me.txtCompStop = New System.Windows.Forms.TextBox()
		Me.txtInternalClock = New System.Windows.Forms.TextBox()
		Me.txtCompStart = New System.Windows.Forms.TextBox()
		Me.cboStartTrg = New System.Windows.Forms.ComboBox()
		Me.Label10 = New System.Windows.Forms.Label()
		Me.Label9 = New System.Windows.Forms.Label()
		Me.Label8 = New System.Windows.Forms.Label()
		Me.Label7 = New System.Windows.Forms.Label()
		Me.Label6 = New System.Windows.Forms.Label()
		Me.Label5 = New System.Windows.Forms.Label()
		Me.Label4 = New System.Windows.Forms.Label()
		Me.Label3 = New System.Windows.Forms.Label()
		Me.Label2 = New System.Windows.Forms.Label()
		Me.Label1 = New System.Windows.Forms.Label()
		Me.Frame4.SuspendLayout()
		Me.Frame2.SuspendLayout()
		Me.Frame3.SuspendLayout()
		Me.Frame1.SuspendLayout()
		Me.SuspendLayout()
		'
		'btnCancel
		'
		Me.btnCancel.BackColor = System.Drawing.SystemColors.Control
		Me.btnCancel.Cursor = System.Windows.Forms.Cursors.Default
		Me.btnCancel.ForeColor = System.Drawing.SystemColors.ControlText
		Me.btnCancel.Location = New System.Drawing.Point(412, 369)
		Me.btnCancel.Name = "btnCancel"
		Me.btnCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.btnCancel.Size = New System.Drawing.Size(78, 23)
		Me.btnCancel.TabIndex = 36
		Me.btnCancel.Text = "Cancel"
		'
		'Frame4
		'
		Me.Frame4.BackColor = System.Drawing.SystemColors.Control
		Me.Frame4.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtNumEvent, Me.Label11})
		Me.Frame4.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame4.Location = New System.Drawing.Point(9, 303)
		Me.Frame4.Name = "Frame4"
		Me.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame4.Size = New System.Drawing.Size(481, 56)
		Me.Frame4.TabIndex = 40
		Me.Frame4.TabStop = False
		Me.Frame4.Text = "Transfer Number Event Notification"
		'
		'txtNumEvent
		'
		Me.txtNumEvent.AcceptsReturn = True
		Me.txtNumEvent.AutoSize = False
		Me.txtNumEvent.BackColor = System.Drawing.SystemColors.Window
		Me.txtNumEvent.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtNumEvent.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtNumEvent.Location = New System.Drawing.Point(110, 26)
		Me.txtNumEvent.MaxLength = 0
		Me.txtNumEvent.Name = "txtNumEvent"
		Me.txtNumEvent.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtNumEvent.Size = New System.Drawing.Size(72, 20)
		Me.txtNumEvent.TabIndex = 23
		Me.txtNumEvent.Text = ""
		'
		'Label11
		'
		Me.Label11.AutoSize = True
		Me.Label11.BackColor = System.Drawing.SystemColors.Control
		Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label11.Location = New System.Drawing.Point(12, 29)
		Me.Label11.Name = "Label11"
		Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label11.Size = New System.Drawing.Size(85, 13)
		Me.Label11.TabIndex = 24
		Me.Label11.Text = "Number of data:"
		'
		'btnOK
		'
		Me.btnOK.BackColor = System.Drawing.SystemColors.Control
		Me.btnOK.Cursor = System.Windows.Forms.Cursors.Default
		Me.btnOK.ForeColor = System.Drawing.SystemColors.ControlText
		Me.btnOK.Location = New System.Drawing.Point(327, 369)
		Me.btnOK.Name = "btnOK"
		Me.btnOK.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.btnOK.Size = New System.Drawing.Size(79, 23)
		Me.btnOK.TabIndex = 35
		Me.btnOK.Text = "OK"
		'
		'Frame2
		'
		Me.Frame2.BackColor = System.Drawing.SystemColors.Control
		Me.Frame2.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoStartCntWithSamp, Me.rdoStartCntNotWithSamp})
		Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame2.Location = New System.Drawing.Point(6, 143)
		Me.Frame2.Name = "Frame2"
		Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame2.Size = New System.Drawing.Size(482, 74)
		Me.Frame2.TabIndex = 38
		Me.Frame2.TabStop = False
		Me.Frame2.Text = "Counter Start Mode"
		'
		'rdoStartCntWithSamp
		'
		Me.rdoStartCntWithSamp.BackColor = System.Drawing.SystemColors.Control
		Me.rdoStartCntWithSamp.Cursor = System.Windows.Forms.Cursors.Default
		Me.rdoStartCntWithSamp.ForeColor = System.Drawing.SystemColors.ControlText
		Me.rdoStartCntWithSamp.Location = New System.Drawing.Point(12, 43)
		Me.rdoStartCntWithSamp.Name = "rdoStartCntWithSamp"
		Me.rdoStartCntWithSamp.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.rdoStartCntWithSamp.Size = New System.Drawing.Size(239, 20)
		Me.rdoStartCntWithSamp.TabIndex = 18
		Me.rdoStartCntWithSamp.TabStop = True
		Me.rdoStartCntWithSamp.Text = "Start counter when sampling starts"
		'
		'rdoStartCntNotWithSamp
		'
		Me.rdoStartCntNotWithSamp.BackColor = System.Drawing.SystemColors.Control
		Me.rdoStartCntNotWithSamp.Cursor = System.Windows.Forms.Cursors.Default
		Me.rdoStartCntNotWithSamp.ForeColor = System.Drawing.SystemColors.ControlText
		Me.rdoStartCntNotWithSamp.Location = New System.Drawing.Point(12, 20)
		Me.rdoStartCntNotWithSamp.Name = "rdoStartCntNotWithSamp"
		Me.rdoStartCntNotWithSamp.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.rdoStartCntNotWithSamp.Size = New System.Drawing.Size(239, 20)
		Me.rdoStartCntNotWithSamp.TabIndex = 17
		Me.rdoStartCntNotWithSamp.TabStop = True
		Me.rdoStartCntNotWithSamp.Text = "Start counter regardless of sampling"
		'
		'Frame3
		'
		Me.Frame3.BackColor = System.Drawing.SystemColors.Control
		Me.Frame3.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoStopCntWithSamp, Me.rdoStopCntNotWithSamp})
		Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame3.Location = New System.Drawing.Point(6, 223)
		Me.Frame3.Name = "Frame3"
		Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame3.Size = New System.Drawing.Size(482, 74)
		Me.Frame3.TabIndex = 39
		Me.Frame3.TabStop = False
		Me.Frame3.Text = "Counter Stop Mode"
		'
		'rdoStopCntWithSamp
		'
		Me.rdoStopCntWithSamp.BackColor = System.Drawing.SystemColors.Control
		Me.rdoStopCntWithSamp.Cursor = System.Windows.Forms.Cursors.Default
		Me.rdoStopCntWithSamp.ForeColor = System.Drawing.SystemColors.ControlText
		Me.rdoStopCntWithSamp.Location = New System.Drawing.Point(12, 43)
		Me.rdoStopCntWithSamp.Name = "rdoStopCntWithSamp"
		Me.rdoStopCntWithSamp.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.rdoStopCntWithSamp.Size = New System.Drawing.Size(239, 20)
		Me.rdoStopCntWithSamp.TabIndex = 21
		Me.rdoStopCntWithSamp.TabStop = True
		Me.rdoStopCntWithSamp.Text = "Stop counter when sampling stops"
		'
		'rdoStopCntNotWithSamp
		'
		Me.rdoStopCntNotWithSamp.BackColor = System.Drawing.SystemColors.Control
		Me.rdoStopCntNotWithSamp.Cursor = System.Windows.Forms.Cursors.Default
		Me.rdoStopCntNotWithSamp.ForeColor = System.Drawing.SystemColors.ControlText
		Me.rdoStopCntNotWithSamp.Location = New System.Drawing.Point(12, 20)
		Me.rdoStopCntNotWithSamp.Name = "rdoStopCntNotWithSamp"
		Me.rdoStopCntNotWithSamp.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.rdoStopCntNotWithSamp.Size = New System.Drawing.Size(239, 20)
		Me.rdoStopCntNotWithSamp.TabIndex = 20
		Me.rdoStopCntNotWithSamp.TabStop = True
		Me.rdoStopCntNotWithSamp.Text = "Stop counter regardless of sampling"
		'
		'Frame1
		'
		Me.Frame1.BackColor = System.Drawing.SystemColors.Control
		Me.Frame1.Controls.AddRange(New System.Windows.Forms.Control() {Me.cboClockTrg, Me.cboStopTrg, Me.txtStopNum, Me.txtCompStop, Me.txtInternalClock, Me.txtCompStart, Me.cboStartTrg, Me.Label10, Me.Label9, Me.Label8, Me.Label7, Me.Label6, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.Label1})
		Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame1.Location = New System.Drawing.Point(6, 6)
		Me.Frame1.Name = "Frame1"
		Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame1.Size = New System.Drawing.Size(482, 131)
		Me.Frame1.TabIndex = 37
		Me.Frame1.TabStop = False
		Me.Frame1.Text = "Sampling Condition"
		'
		'cboClockTrg
		'
		Me.cboClockTrg.BackColor = System.Drawing.SystemColors.Window
		Me.cboClockTrg.Cursor = System.Windows.Forms.Cursors.Default
		Me.cboClockTrg.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cboClockTrg.ForeColor = System.Drawing.SystemColors.WindowText
		Me.cboClockTrg.Location = New System.Drawing.Point(52, 46)
		Me.cboClockTrg.Name = "cboClockTrg"
		Me.cboClockTrg.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.cboClockTrg.Size = New System.Drawing.Size(213, 21)
		Me.cboClockTrg.TabIndex = 11
		'
		'cboStopTrg
		'
		Me.cboStopTrg.BackColor = System.Drawing.SystemColors.Window
		Me.cboStopTrg.Cursor = System.Windows.Forms.Cursors.Default
		Me.cboStopTrg.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cboStopTrg.ForeColor = System.Drawing.SystemColors.WindowText
		Me.cboStopTrg.Location = New System.Drawing.Point(52, 72)
		Me.cboStopTrg.Name = "cboStopTrg"
		Me.cboStopTrg.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.cboStopTrg.Size = New System.Drawing.Size(213, 21)
		Me.cboStopTrg.TabIndex = 12
		'
		'txtStopNum
		'
		Me.txtStopNum.AcceptsReturn = True
		Me.txtStopNum.AutoSize = False
		Me.txtStopNum.BackColor = System.Drawing.SystemColors.Window
		Me.txtStopNum.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtStopNum.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtStopNum.Location = New System.Drawing.Point(362, 98)
		Me.txtStopNum.MaxLength = 0
		Me.txtStopNum.Name = "txtStopNum"
		Me.txtStopNum.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtStopNum.Size = New System.Drawing.Size(72, 20)
		Me.txtStopNum.TabIndex = 28
		Me.txtStopNum.Text = ""
		'
		'txtCompStop
		'
		Me.txtCompStop.AcceptsReturn = True
		Me.txtCompStop.AutoSize = False
		Me.txtCompStop.BackColor = System.Drawing.SystemColors.Window
		Me.txtCompStop.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtCompStop.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtCompStop.Location = New System.Drawing.Point(362, 72)
		Me.txtCompStop.MaxLength = 0
		Me.txtCompStop.Name = "txtCompStop"
		Me.txtCompStop.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtCompStop.Size = New System.Drawing.Size(72, 20)
		Me.txtCompStop.TabIndex = 27
		Me.txtCompStop.Text = ""
		'
		'txtInternalClock
		'
		Me.txtInternalClock.AcceptsReturn = True
		Me.txtInternalClock.AutoSize = False
		Me.txtInternalClock.BackColor = System.Drawing.SystemColors.Window
		Me.txtInternalClock.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtInternalClock.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtInternalClock.Location = New System.Drawing.Point(362, 46)
		Me.txtInternalClock.MaxLength = 0
		Me.txtInternalClock.Name = "txtInternalClock"
		Me.txtInternalClock.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtInternalClock.Size = New System.Drawing.Size(72, 20)
		Me.txtInternalClock.TabIndex = 26
		Me.txtInternalClock.Text = ""
		'
		'txtCompStart
		'
		Me.txtCompStart.AcceptsReturn = True
		Me.txtCompStart.AutoSize = False
		Me.txtCompStart.BackColor = System.Drawing.SystemColors.Window
		Me.txtCompStart.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtCompStart.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtCompStart.Location = New System.Drawing.Point(362, 20)
		Me.txtCompStart.MaxLength = 0
		Me.txtCompStart.Name = "txtCompStart"
		Me.txtCompStart.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtCompStart.Size = New System.Drawing.Size(72, 20)
		Me.txtCompStart.TabIndex = 25
		Me.txtCompStart.Text = ""
		'
		'cboStartTrg
		'
		Me.cboStartTrg.BackColor = System.Drawing.SystemColors.Window
		Me.cboStartTrg.Cursor = System.Windows.Forms.Cursors.Default
		Me.cboStartTrg.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cboStartTrg.ForeColor = System.Drawing.SystemColors.WindowText
		Me.cboStartTrg.Location = New System.Drawing.Point(52, 20)
		Me.cboStartTrg.Name = "cboStartTrg"
		Me.cboStartTrg.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.cboStartTrg.Size = New System.Drawing.Size(213, 21)
		Me.cboStartTrg.TabIndex = 10
		'
		'Label10
		'
		Me.Label10.AutoSize = True
		Me.Label10.BackColor = System.Drawing.SystemColors.Control
		Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label10.Location = New System.Drawing.Point(440, 75)
		Me.Label10.Name = "Label10"
		Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label10.Size = New System.Drawing.Size(24, 13)
		Me.Label10.TabIndex = 15
		Me.Label10.Text = "Hex"
		'
		'Label9
		'
		Me.Label9.AutoSize = True
		Me.Label9.BackColor = System.Drawing.SystemColors.Control
		Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label9.Location = New System.Drawing.Point(440, 49)
		Me.Label9.Name = "Label9"
		Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label9.Size = New System.Drawing.Size(16, 13)
		Me.Label9.TabIndex = 14
		Me.Label9.Text = "ns"
		'
		'Label8
		'
		Me.Label8.AutoSize = True
		Me.Label8.BackColor = System.Drawing.SystemColors.Control
		Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label8.Location = New System.Drawing.Point(440, 23)
		Me.Label8.Name = "Label8"
		Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label8.Size = New System.Drawing.Size(24, 13)
		Me.Label8.TabIndex = 13
		Me.Label8.Text = "Hex"
		'
		'Label7
		'
		Me.Label7.AutoSize = True
		Me.Label7.BackColor = System.Drawing.SystemColors.Control
		Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label7.Location = New System.Drawing.Point(275, 101)
		Me.Label7.Name = "Label7"
		Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label7.Size = New System.Drawing.Size(74, 13)
		Me.Label7.TabIndex = 9
		Me.Label7.Text = "Stop Number:"
		'
		'Label6
		'
		Me.Label6.AutoSize = True
		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(275, 75)
		Me.Label6.Name = "Label6"
		Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label6.Size = New System.Drawing.Size(86, 13)
		Me.Label6.TabIndex = 8
		Me.Label6.Text = "Compare Value:"
		'
		'Label5
		'
		Me.Label5.AutoSize = True
		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(275, 49)
		Me.Label5.Name = "Label5"
		Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label5.Size = New System.Drawing.Size(77, 13)
		Me.Label5.TabIndex = 7
		Me.Label5.Text = "Internal Clock:"
		'
		'Label4
		'
		Me.Label4.AutoSize = True
		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(275, 23)
		Me.Label4.Name = "Label4"
		Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label4.Size = New System.Drawing.Size(86, 13)
		Me.Label4.TabIndex = 6
		Me.Label4.Text = "Compare Value:"
		'
		'Label3
		'
		Me.Label3.AutoSize = True
		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(12, 75)
		Me.Label3.Name = "Label3"
		Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label3.Size = New System.Drawing.Size(31, 13)
		Me.Label3.TabIndex = 5
		Me.Label3.Text = "Stop:"
		'
		'Label2
		'
		Me.Label2.AutoSize = True
		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(12, 49)
		Me.Label2.Name = "Label2"
		Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label2.Size = New System.Drawing.Size(36, 13)
		Me.Label2.TabIndex = 4
		Me.Label2.Text = "Clock:"
		'
		'Label1
		'
		Me.Label1.AutoSize = True
		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(12, 23)
		Me.Label1.Name = "Label1"
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.Size = New System.Drawing.Size(31, 13)
		Me.Label1.TabIndex = 3
		Me.Label1.Text = "Start:"
		'
		'ConditionDlg
		'
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.ClientSize = New System.Drawing.Size(496, 398)
		Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnCancel, Me.Frame4, Me.btnOK, Me.Frame2, Me.Frame3, Me.Frame1})
		Me.MaximizeBox = False
		Me.MinimizeBox = False
		Me.Name = "ConditionDlg"
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.Text = "Sampling Condition Setting"
		Me.Frame4.ResumeLayout(False)
		Me.Frame2.ResumeLayout(False)
		Me.Frame3.ResumeLayout(False)
		Me.Frame1.ResumeLayout(False)
		Me.ResumeLayout(False)

	End Sub

#End Region

	Dim StartComp As Integer
	Dim StopComp As Integer

	Dim InternalClock As Integer
	Dim StopNumber As Integer
	Public Shared NumberOfData As Integer
	Dim StartCountMode As Short
	Dim StopCountMode As Short

	'===================================================
	' Dialog initialization
	'===================================================
	Private Sub ConditionDlg_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

		'--------------------------------
		' Initialize display
		'--------------------------------
		cboStartTrg.Items.Clear()
		cboStartTrg.Items.Insert(0, "Software start")
		cboStartTrg.Items.Insert(1, "External signal rising")
		cboStartTrg.Items.Insert(2, "External signal falling")
		cboStartTrg.Items.Insert(3, "Count-match CH0 Compare-register 0")
		cboStartTrg.Items.Insert(4, "Count-match CH1 Compare-register 0")
		cboStartTrg.Items.Insert(5, "Count-match CH2 Compare-register 0")
		cboStartTrg.Items.Insert(6, "Count-match CH3 Compare-register 0")
		cboStartTrg.Items.Insert(7, "Count-match CH0 Compare-register 1")
		cboStartTrg.Items.Insert(8, "Count-match CH1 Compare-register 1")
		cboStartTrg.Items.Insert(9, "Count-match CH2 Compare-register 1")
		cboStartTrg.Items.Insert(10, "Count-match CH3 Compare-register 1")

		cboClockTrg.Items.Clear()
		cboClockTrg.Items.Insert(0, "Internal clock")
		cboClockTrg.Items.Insert(1, "External clock")

		cboStopTrg.Items.Clear()
		cboStopTrg.Items.Insert(0, "Software stop")
		cboStopTrg.Items.Insert(1, "External signal rising")
		cboStopTrg.Items.Insert(2, "External signal falling")
		cboStopTrg.Items.Insert(3, "Stop transfer by specified times")
		cboStopTrg.Items.Insert(4, "Count-match CH0 Compare-register 0")
		cboStopTrg.Items.Insert(5, "Count-match CH1 Compare-register 0")
		cboStopTrg.Items.Insert(6, "Count-match CH2 Compare-register 0")
		cboStopTrg.Items.Insert(7, "Count-match CH3 Compare-register 0")
		cboStopTrg.Items.Insert(8, "Count-match CH0 Compare-register 1")
		cboStopTrg.Items.Insert(9, "Count-match CH1 Compare-register 1")
		cboStopTrg.Items.Insert(10, "Count-match CH2 Compare-register 1")
		cboStopTrg.Items.Insert(11, "Count-match CH3 Compare-register 1")


		cboStartTrg.Text = "Software start"
		cboClockTrg.Text = "Internal clock"
		cboStopTrg.Text = "Software stop"

		If StartCountMode = CNTS_START_CNT_NOT_WITH_SAMP Then
			rdoStartCntNotWithSamp.Checked = True
			rdoStartCntWithSamp.Checked = False
		Else
			rdoStartCntNotWithSamp.Checked = False
			rdoStartCntWithSamp.Checked = True
		End If
		If StopCountMode = CNTS_STOP_CNT_NOT_WITH_SAMP Then
			rdoStopCntNotWithSamp.Checked = True
			rdoStopCntWithSamp.Checked = False
		Else
			rdoStopCntNotWithSamp.Checked = False
			rdoStopCntWithSamp.Checked = True
		End If

		txtCompStart.Text = 100
		txtInternalClock.Text = 100000
		txtStopNum.Text = 1000
		txtNumEvent.Text = 500
		txtCompStop.Text = 200

		cboStartTrg_SelectedIndexChanged(cboStartTrg, New System.EventArgs())
		cboClockTrg_SelectedIndexChanged(cboClockTrg, New System.EventArgs())
		cboStopTrg_SelectedIndexChanged(cboStopTrg, New System.EventArgs())

	End Sub

	'===================================================
	' Start condition setting is changed
	'===================================================
	Private Sub cboStartTrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboStartTrg.SelectedIndexChanged

		Dim szBuf As New String("", 100)

		szBuf = cboStartTrg.Text
		If szBuf.StartsWith("Count-match") Then
			txtCompStart.Enabled = True
		Else
			txtCompStart.Enabled = False
		End If

	End Sub

	'===================================================
	' Clock condition setting is changed
	'===================================================
	Private Sub cboClockTrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboClockTrg.SelectedIndexChanged

		Dim szBuf As New String("", 100)

		'--------------------------------
		' Enable/Disable internal clock value
		'--------------------------------
		szBuf = cboClockTrg.Text
		If String.Compare(szBuf, "Internal clock") = 0 Then
			txtInternalClock.Enabled = True
		Else
			txtInternalClock.Enabled = False
		End If

	End Sub

	'===================================================
	' Stop condition setting is changed
	'===================================================
	Private Sub cboStopTrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboStopTrg.SelectedIndexChanged

		Dim szBuf As New String("", 100)

		szBuf = cboStopTrg.Text
		If szBuf.StartsWith("Count-match") Then
			txtCompStop.Enabled = True
		Else
			txtCompStop.Enabled = False
		End If
		If String.Compare(szBuf, "Stop transfer by specified times") = 0 Then
			txtStopNum.Enabled = True
		Else
			txtStopNum.Enabled = False
		End If

	End Sub

	'===================================================
	' OK button processing
	'===================================================
	Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        Dim error_string As New StringBuilder("", 256)
		Dim szTmp As New String("", 100)
		Dim StartTrg As Short
		Dim ClockTrg As Short
		Dim StopTrg As Short
		Dim ret As Integer
		Dim strMsg As String
		Dim CompChNo As Short
		Dim CompRegNo As Short

		'--------------------------------
		' Get displayed data
		'--------------------------------
		If rdoStartCntNotWithSamp.Checked = True Then
			StartCountMode = CNTS_START_CNT_NOT_WITH_SAMP
		Else
			StartCountMode = CNTS_START_CNT_WITH_SAMP
		End If
		If rdoStopCntNotWithSamp.Checked = True Then
			StopCountMode = CNTS_STOP_CNT_NOT_WITH_SAMP
		Else
			StopCountMode = CNTS_STOP_CNT_WITH_SAMP
		End If

		szTmp = txtCompStart.Text
		Try
			StartComp = Integer.Parse(szTmp, NumberStyles.HexNumber)
		Catch ex As Exception
			StartComp = &H100
		End Try

		szTmp = txtCompStop.Text
		Try
			StopComp = Integer.Parse(szTmp, NumberStyles.HexNumber)
		Catch ex As Exception
			StopComp = &H200
		End Try

		' In order to set the internal clock to signed, convert it once through hexadecimal characters
		szTmp = Str(Convert.ToInt32(Hex(Val(txtInternalClock.Text)), 16))
		Try
			InternalClock = Integer.Parse(szTmp)
		Catch ex As Exception
			InternalClock = 100000
		End Try

		' In order to set the stop number to signed, convert it once through hexadecimal characters
		szTmp = Str(Convert.ToInt32(Hex(Val(txtStopNum.Text)), 16))
		Try
			StopNumber = Integer.Parse(szTmp)
		Catch ex As Exception
			StopNumber = 1000
		End Try

		' In order to set the number of sampling cycles for notification to signed, convert it once through hexadecimal characters
		szTmp = Str(Convert.ToInt32(Hex(Val(txtNumEvent.Text)), 16))
		Try
			NumberOfData = Integer.Parse(szTmp)
		Catch ex As Exception
			NumberOfData = 500
		End Try

		'--------------------------------
		' Convert setting value to a number
		'--------------------------------
		StartTrg = 0
		Select Case cboStartTrg.SelectedIndex
			Case 0
				StartTrg = CNTS_START_SOFT
			Case 1
				StartTrg = CNTS_START_EXT_RISE
			Case 2
				StartTrg = CNTS_START_EXT_FALL
			Case 3
				StartTrg = CNTS_START_CNTMATCH_CH0_REG0
			Case 4
				StartTrg = CNTS_START_CNTMATCH_CH1_REG0
			Case 5
				StartTrg = CNTS_START_CNTMATCH_CH2_REG0
			Case 6
				StartTrg = CNTS_START_CNTMATCH_CH3_REG0
			Case 7
				StartTrg = CNTS_START_CNTMATCH_CH0_REG1
			Case 8
				StartTrg = CNTS_START_CNTMATCH_CH1_REG1
			Case 9
				StartTrg = CNTS_START_CNTMATCH_CH2_REG1
			Case 10
				StartTrg = CNTS_START_CNTMATCH_CH3_REG1
		End Select

		ClockTrg = 0
		Select Case cboClockTrg.SelectedIndex
			Case 0
				ClockTrg = CNTS_CLOCK_CLOCK
			Case 1
				ClockTrg = CNTS_CLOCK_EXT_TRG
		End Select

		StopTrg = 0
		Select Case cboStopTrg.SelectedIndex
			Case 0
				StopTrg = CNTS_STOP_SOFT
			Case 1
				StopTrg = CNTS_STOP_EXT_RISE
			Case 2
				StopTrg = CNTS_STOP_EXT_FALL
			Case 3
				StopTrg = CNTS_STOP_NUM
			Case 4
				StopTrg = CNTS_STOP_CNTMATCH_CH0_REG0
			Case 5
				StopTrg = CNTS_STOP_CNTMATCH_CH1_REG0
			Case 6
				StopTrg = CNTS_STOP_CNTMATCH_CH2_REG0
			Case 7
				StopTrg = CNTS_STOP_CNTMATCH_CH3_REG0
			Case 8
				StopTrg = CNTS_STOP_CNTMATCH_CH0_REG1
			Case 9
				StopTrg = CNTS_STOP_CNTMATCH_CH1_REG1
			Case 10
				StopTrg = CNTS_STOP_CNTMATCH_CH2_REG1
			Case 11
				StopTrg = CNTS_STOP_CNTMATCH_CH3_REG1
		End Select

		'--------------------------------
		' Set sampling condition
		'--------------------------------
		' Stand-alone
		ret = CntSetStandAlone(Id)
		If ret <> CNT_ERR_SUCCESS Then
			CntGetErrorString(ret, error_string)
			strMsg = String.Format("CntSetStandAlone ret = {0:d}: {1}", ret, error_string)
			MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			Exit Sub
		End If
		' Set start condition
		ret = CntSetSamplingStartTrigger(Id, StartTrg, StartCountMode, CHANNEL_NUM)
		If ret <> CNT_ERR_SUCCESS Then
			CntGetErrorString(ret, error_string)
			strMsg = String.Format("CntSetSamplingStartTrigger ret = {0:d}: {1}", ret, error_string)
			MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			Exit Sub
		End If
		Select Case StartTrg
			Case CNTS_START_CNTMATCH_CH0_REG0
				CompChNo = 0
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH1_REG0
				CompChNo = 1
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH2_REG0
				CompChNo = 2
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH3_REG0
				CompChNo = 3
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH4_REG0
				CompChNo = 4
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH5_REG0
				CompChNo = 5
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH6_REG0
				CompChNo = 6
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH7_REG0
				CompChNo = 7
				CompRegNo = 0
			Case CNTS_START_CNTMATCH_CH0_REG1
				CompChNo = 0
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH1_REG1
				CompChNo = 1
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH2_REG1
				CompChNo = 2
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH3_REG1
				CompChNo = 3
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH4_REG1
				CompChNo = 4
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH5_REG1
				CompChNo = 5
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH6_REG1
				CompChNo = 6
				CompRegNo = 1
			Case CNTS_START_CNTMATCH_CH7_REG1
				CompChNo = 7
				CompRegNo = 1
			Case Else
				CompChNo = &HFFF
				CompRegNo = &HFFF
		End Select
		If CompChNo <> &HFFF And CompRegNo <> &HFFF Then
			ret = CntNotifyCountUp(Id, CompChNo, CompRegNo, StartComp, 0)
			If ret <> 0 Then
				CntGetErrorString(ret, error_string)
				strMsg = String.Format("CntNotifyCountUp ret = {0:d}: {1}", ret, error_string)
				MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			End If
		End If
		' Set clock condition
		ret = CntSetSamplingClockTrigger(Id, ClockTrg)
		If ret <> CNT_ERR_SUCCESS Then
			CntGetErrorString(ret, error_string)
			strMsg = String.Format("CntSetSamplingClockTrigger ret = {0:d}: {1}", ret, error_string)
			MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			Exit Sub
		End If
		' Set internal clock value
		If ClockTrg = CNTS_CLOCK_CLOCK Then
			ret = CntSetSamplingInternalClock(Id, InternalClock, CNTS_TIM_UNIT_NS)
			If ret <> CNT_ERR_SUCCESS Then
				CntGetErrorString(ret, error_string)
				strMsg = String.Format("CntSetSamplingInternalClock ret = {0:d}: {1}", ret, error_string)
				MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
				Exit Sub
			End If
		End If

		' Set stop condition
		ret = CntSetSamplingStopTrigger(Id, StopTrg, StopCountMode, CHANNEL_NUM)
		If ret <> CNT_ERR_SUCCESS Then
			CntGetErrorString(ret, error_string)
			strMsg = String.Format("CntSetSamplingStopTrigger ret = {0:d}: {1}", ret, error_string)
			MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			Exit Sub
		End If
		Select Case StopTrg
			Case CNTS_STOP_CNTMATCH_CH0_REG0
				CompChNo = 0
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH1_REG0
				CompChNo = 1
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH2_REG0
				CompChNo = 2
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH3_REG0
				CompChNo = 3
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH4_REG0
				CompChNo = 4
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH5_REG0
				CompChNo = 5
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH6_REG0
				CompChNo = 6
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH7_REG0
				CompChNo = 7
				CompRegNo = 0
			Case CNTS_STOP_CNTMATCH_CH0_REG1
				CompChNo = 0
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH1_REG1
				CompChNo = 1
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH2_REG1
				CompChNo = 2
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH3_REG1
				CompChNo = 3
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH4_REG1
				CompChNo = 4
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH5_REG1
				CompChNo = 5
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH6_REG1
				CompChNo = 6
				CompRegNo = 1
			Case CNTS_STOP_CNTMATCH_CH7_REG1
				CompChNo = 7
				CompRegNo = 1
			Case Else
				CompChNo = &HFFF
				CompRegNo = &HFFF
		End Select
		If CompChNo <> &HFFF And CompRegNo <> &HFFF Then
			ret = CntNotifyCountUp(Id, CompChNo, CompRegNo, StopComp, 0)
			If ret <> 0 Then
				CntGetErrorString(ret, error_string)
				strMsg = String.Format("CntNotifyCountUp ret = {0:d}: {1}", ret, error_string)
				MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
			End If
		End If
		' Set stop number
		If StopTrg = CNTS_STOP_NUM Then
			ret = CntSetSamplingStopNumber(Id, StopNumber)
			If ret <> CNT_ERR_SUCCESS Then
				CntGetErrorString(ret, error_string)
				strMsg = String.Format("CntSetSamplingInternalClock ret = {0:d}: {1}", ret, error_string)
				MessageBox.Show(strMsg, Application.ProductName, MessageBoxButtons.OK)
				Exit Sub
			End If
		End If
		Me.Hide()

	End Sub

	'---------------------------------------------
	' Cancel button processing
	'---------------------------------------------
	Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click

		Me.Hide()

	End Sub

	Private Sub ConditionDlg_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

		e.Cancel = True
		Me.Hide()

	End Sub
End Class
