Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class frmClient
	Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'For the start-up form, the first instance created is the default instance.
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'This call is required by the Windows Form Designer.
		InitializeComponent()
	End Sub
	'Form overrides dispose to clean up the component list.
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents lblOnlyChannel1 As System.Windows.Forms.Label
	Public WithEvents fraGetFastSampling2 As System.Windows.Forms.GroupBox
	Public WithEvents _cmdFunctionRequest_6 As System.Windows.Forms.Button
	Public WithEvents Label6 As System.Windows.Forms.Label
	Public WithEvents _lblConnectedCounter_6 As System.Windows.Forms.Label
	Public WithEvents Frame8 As System.Windows.Forms.GroupBox
	Public WithEvents rtfFeedback As AxRichTextLib.AxRichTextBox
	Public WithEvents _cmdFunctionRequest_5 As System.Windows.Forms.Button
	Public WithEvents _lblConnectedCounter_5 As System.Windows.Forms.Label
	Public WithEvents Label4 As System.Windows.Forms.Label
	Public WithEvents Frame7 As System.Windows.Forms.GroupBox
	Public WithEvents tmrTimeout As System.Windows.Forms.Timer
	Public WithEvents _cmdFunctionRequest_4 As System.Windows.Forms.Button
	Public WithEvents _cmdFunctionRequest_3 As System.Windows.Forms.Button
	Public WithEvents Label9 As System.Windows.Forms.Label
	Public WithEvents _lblConnectedCounter_4 As System.Windows.Forms.Label
	Public WithEvents _lblConnectedCounter_3 As System.Windows.Forms.Label
	Public WithEvents Label2 As System.Windows.Forms.Label
	Public WithEvents FraChannel As System.Windows.Forms.GroupBox
	Public WithEvents cmdResetCounters As System.Windows.Forms.Button
	Public WithEvents txtSetPoint As System.Windows.Forms.TextBox
	Public WithEvents fraSetPoint As System.Windows.Forms.GroupBox
	Public WithEvents txtOutStatus As System.Windows.Forms.TextBox
	Public WithEvents Frame4 As System.Windows.Forms.GroupBox
	Public WithEvents _cmdFunctionRequest_2 As System.Windows.Forms.Button
	Public WithEvents Label3 As System.Windows.Forms.Label
	Public WithEvents _lblConnectedCounter_2 As System.Windows.Forms.Label
	Public WithEvents Frame3 As System.Windows.Forms.GroupBox
	Public WithEvents optShort As System.Windows.Forms.RadioButton
	Public WithEvents optLong As System.Windows.Forms.RadioButton
	Public WithEvents _cmdFunctionRequest_1 As System.Windows.Forms.Button
	Public WithEvents Label5 As System.Windows.Forms.Label
	Public WithEvents _lblConnectedCounter_1 As System.Windows.Forms.Label
	Public WithEvents fraGetFastSampling1 As System.Windows.Forms.GroupBox
	Public WithEvents cmdAuto As System.Windows.Forms.Button
	Public WithEvents _cmdFunctionRequest_0 As System.Windows.Forms.Button
	Public WithEvents _lblConnectedCounter_0 As System.Windows.Forms.Label
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents txtIP As System.Windows.Forms.TextBox
	Public WithEvents tcpClient As AxMSWinsockLib.AxWinsock
	Public WithEvents lblIntegrationData As System.Windows.Forms.Label
	Public WithEvents lblIntegration As System.Windows.Forms.Label
	Public WithEvents lblUnit As System.Windows.Forms.Label
	Public WithEvents lblA2D As System.Windows.Forms.Label
	Public WithEvents Label8 As System.Windows.Forms.Label
	Public WithEvents lblWeight As System.Windows.Forms.Label
	Public WithEvents Label7 As System.Windows.Forms.Label
	Public WithEvents lblServerAddress As System.Windows.Forms.Label
	Public WithEvents cmdFunctionRequest As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
	Public WithEvents lblConnectedCounter As Microsoft.VisualBasic.Compatibility.VB6.LabelArray
	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.
	'Do not modify it using the code editor.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmClient))
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.txtSetPoint = New System.Windows.Forms.TextBox
        Me.fraGetFastSampling2 = New System.Windows.Forms.GroupBox
        Me.lblOnlyChannel1 = New System.Windows.Forms.Label
        Me.Frame8 = New System.Windows.Forms.GroupBox
        Me._cmdFunctionRequest_6 = New System.Windows.Forms.Button
        Me.Label6 = New System.Windows.Forms.Label
        Me._lblConnectedCounter_6 = New System.Windows.Forms.Label
        Me.rtfFeedback = New AxRichTextLib.AxRichTextBox
        Me.Frame7 = New System.Windows.Forms.GroupBox
        Me._cmdFunctionRequest_5 = New System.Windows.Forms.Button
        Me._lblConnectedCounter_5 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.tmrTimeout = New System.Windows.Forms.Timer(Me.components)
        Me.FraChannel = New System.Windows.Forms.GroupBox
        Me._cmdFunctionRequest_4 = New System.Windows.Forms.Button
        Me._cmdFunctionRequest_3 = New System.Windows.Forms.Button
        Me.Label9 = New System.Windows.Forms.Label
        Me._lblConnectedCounter_4 = New System.Windows.Forms.Label
        Me._lblConnectedCounter_3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.cmdResetCounters = New System.Windows.Forms.Button
        Me.Frame3 = New System.Windows.Forms.GroupBox
        Me.fraSetPoint = New System.Windows.Forms.GroupBox
        Me.Frame4 = New System.Windows.Forms.GroupBox
        Me.txtOutStatus = New System.Windows.Forms.TextBox
        Me._cmdFunctionRequest_2 = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me._lblConnectedCounter_2 = New System.Windows.Forms.Label
        Me.fraGetFastSampling1 = New System.Windows.Forms.GroupBox
        Me.optShort = New System.Windows.Forms.RadioButton
        Me.optLong = New System.Windows.Forms.RadioButton
        Me._cmdFunctionRequest_1 = New System.Windows.Forms.Button
        Me.Label5 = New System.Windows.Forms.Label
        Me._lblConnectedCounter_1 = New System.Windows.Forms.Label
        Me.Frame1 = New System.Windows.Forms.GroupBox
        Me.cmdAuto = New System.Windows.Forms.Button
        Me._cmdFunctionRequest_0 = New System.Windows.Forms.Button
        Me._lblConnectedCounter_0 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.txtIP = New System.Windows.Forms.TextBox
        Me.tcpClient = New AxMSWinsockLib.AxWinsock
        Me.lblIntegrationData = New System.Windows.Forms.Label
        Me.lblIntegration = New System.Windows.Forms.Label
        Me.lblUnit = New System.Windows.Forms.Label
        Me.lblA2D = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.lblWeight = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.lblServerAddress = New System.Windows.Forms.Label
        Me.cmdFunctionRequest = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(Me.components)
        Me.lblConnectedCounter = New Microsoft.VisualBasic.Compatibility.VB6.LabelArray(Me.components)
        Me.fraGetFastSampling2.SuspendLayout()
        Me.Frame8.SuspendLayout()
        CType(Me.rtfFeedback, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.Frame7.SuspendLayout()
        Me.FraChannel.SuspendLayout()
        Me.Frame3.SuspendLayout()
        Me.fraSetPoint.SuspendLayout()
        Me.Frame4.SuspendLayout()
        Me.fraGetFastSampling1.SuspendLayout()
        Me.Frame1.SuspendLayout()
        CType(Me.tcpClient, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.cmdFunctionRequest, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.lblConnectedCounter, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'txtSetPoint
        '
        Me.txtSetPoint.AcceptsReturn = True
        Me.txtSetPoint.AutoSize = False
        Me.txtSetPoint.BackColor = System.Drawing.SystemColors.Window
        Me.txtSetPoint.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtSetPoint.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.txtSetPoint.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtSetPoint.Location = New System.Drawing.Point(8, 13)
        Me.txtSetPoint.MaxLength = 0
        Me.txtSetPoint.Name = "txtSetPoint"
        Me.txtSetPoint.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtSetPoint.Size = New System.Drawing.Size(57, 19)
        Me.txtSetPoint.TabIndex = 17
        Me.txtSetPoint.Text = ""
        Me.txtSetPoint.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        Me.ToolTip1.SetToolTip(Me.txtSetPoint, "Refers to channel #1 only")
        '
        'fraGetFastSampling2
        '
        Me.fraGetFastSampling2.BackColor = System.Drawing.SystemColors.Control
        Me.fraGetFastSampling2.Controls.Add(Me.lblOnlyChannel1)
        Me.fraGetFastSampling2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.fraGetFastSampling2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.fraGetFastSampling2.Location = New System.Drawing.Point(600, 448)
        Me.fraGetFastSampling2.Name = "fraGetFastSampling2"
        Me.fraGetFastSampling2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.fraGetFastSampling2.Size = New System.Drawing.Size(73, 65)
        Me.fraGetFastSampling2.TabIndex = 45
        Me.fraGetFastSampling2.TabStop = False
        Me.fraGetFastSampling2.Text = "GetFastSampling"
        Me.fraGetFastSampling2.Visible = False
        '
        'lblOnlyChannel1
        '
        Me.lblOnlyChannel1.BackColor = System.Drawing.SystemColors.Control
        Me.lblOnlyChannel1.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblOnlyChannel1.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.lblOnlyChannel1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblOnlyChannel1.Location = New System.Drawing.Point(8, 16)
        Me.lblOnlyChannel1.Name = "lblOnlyChannel1"
        Me.lblOnlyChannel1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblOnlyChannel1.Size = New System.Drawing.Size(57, 41)
        Me.lblOnlyChannel1.TabIndex = 46
        Me.lblOnlyChannel1.Text = "N/A"
        Me.lblOnlyChannel1.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Frame8
        '
        Me.Frame8.BackColor = System.Drawing.SystemColors.Control
        Me.Frame8.Controls.Add(Me._cmdFunctionRequest_6)
        Me.Frame8.Controls.Add(Me.Label6)
        Me.Frame8.Controls.Add(Me._lblConnectedCounter_6)
        Me.Frame8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame8.Location = New System.Drawing.Point(612, 294)
        Me.Frame8.Name = "Frame8"
        Me.Frame8.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame8.Size = New System.Drawing.Size(121, 113)
        Me.Frame8.TabIndex = 33
        Me.Frame8.TabStop = False
        Me.Frame8.Text = "StopSample"
        '
        '_cmdFunctionRequest_6
        '
        Me._cmdFunctionRequest_6.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_6.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_6, CType(6, Short))
        Me._cmdFunctionRequest_6.Location = New System.Drawing.Point(40, 24)
        Me._cmdFunctionRequest_6.Name = "_cmdFunctionRequest_6"
        Me._cmdFunctionRequest_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_6.Size = New System.Drawing.Size(41, 29)
        Me._cmdFunctionRequest_6.TabIndex = 34
        Me._cmdFunctionRequest_6.Text = "Do"
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.BackColor = System.Drawing.SystemColors.Control
        Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label6.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label6.Location = New System.Drawing.Point(10, 66)
        Me.Label6.Name = "Label6"
        Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label6.Size = New System.Drawing.Size(110, 16)
        Me.Label6.TabIndex = 36
        Me.Label6.Text = """Connected"" Counter"
        '
        '_lblConnectedCounter_6
        '
        Me._lblConnectedCounter_6.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_6.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_6.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_6, CType(6, Short))
        Me._lblConnectedCounter_6.Location = New System.Drawing.Point(19, 84)
        Me._lblConnectedCounter_6.Name = "_lblConnectedCounter_6"
        Me._lblConnectedCounter_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_6.Size = New System.Drawing.Size(81, 21)
        Me._lblConnectedCounter_6.TabIndex = 35
        Me._lblConnectedCounter_6.Text = "0"
        Me._lblConnectedCounter_6.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'rtfFeedback
        '
        Me.rtfFeedback.Location = New System.Drawing.Point(24, 164)
        Me.rtfFeedback.Name = "rtfFeedback"
        Me.rtfFeedback.OcxState = CType(resources.GetObject("rtfFeedback.OcxState"), System.Windows.Forms.AxHost.State)
        Me.rtfFeedback.Size = New System.Drawing.Size(555, 341)
        Me.rtfFeedback.TabIndex = 32
        '
        'Frame7
        '
        Me.Frame7.BackColor = System.Drawing.SystemColors.Control
        Me.Frame7.Controls.Add(Me._cmdFunctionRequest_5)
        Me.Frame7.Controls.Add(Me._lblConnectedCounter_5)
        Me.Frame7.Controls.Add(Me.Label4)
        Me.Frame7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame7.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame7.Location = New System.Drawing.Point(612, 214)
        Me.Frame7.Name = "Frame7"
        Me.Frame7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame7.Size = New System.Drawing.Size(121, 73)
        Me.Frame7.TabIndex = 26
        Me.Frame7.TabStop = False
        Me.Frame7.Text = "StartSample"
        '
        '_cmdFunctionRequest_5
        '
        Me._cmdFunctionRequest_5.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_5.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_5, CType(5, Short))
        Me._cmdFunctionRequest_5.Location = New System.Drawing.Point(40, 16)
        Me._cmdFunctionRequest_5.Name = "_cmdFunctionRequest_5"
        Me._cmdFunctionRequest_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_5.Size = New System.Drawing.Size(41, 13)
        Me._cmdFunctionRequest_5.TabIndex = 27
        Me._cmdFunctionRequest_5.Text = "Do"
        Me._cmdFunctionRequest_5.Visible = False
        '
        '_lblConnectedCounter_5
        '
        Me._lblConnectedCounter_5.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_5.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_5.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_5, CType(5, Short))
        Me._lblConnectedCounter_5.Location = New System.Drawing.Point(19, 44)
        Me._lblConnectedCounter_5.Name = "_lblConnectedCounter_5"
        Me._lblConnectedCounter_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_5.Size = New System.Drawing.Size(81, 21)
        Me._lblConnectedCounter_5.TabIndex = 29
        Me._lblConnectedCounter_5.Text = "0"
        Me._lblConnectedCounter_5.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.BackColor = System.Drawing.SystemColors.Control
        Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label4.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label4.Location = New System.Drawing.Point(8, 24)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(110, 16)
        Me.Label4.TabIndex = 28
        Me.Label4.Text = """Connected"" Counter"
        '
        'tmrTimeout
        '
        Me.tmrTimeout.Interval = 6000
        '
        'FraChannel
        '
        Me.FraChannel.BackColor = System.Drawing.SystemColors.ActiveBorder
        Me.FraChannel.Controls.Add(Me._cmdFunctionRequest_4)
        Me.FraChannel.Controls.Add(Me._cmdFunctionRequest_3)
        Me.FraChannel.Controls.Add(Me.Label9)
        Me.FraChannel.Controls.Add(Me._lblConnectedCounter_4)
        Me.FraChannel.Controls.Add(Me._lblConnectedCounter_3)
        Me.FraChannel.Controls.Add(Me.Label2)
        Me.FraChannel.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FraChannel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.FraChannel.Location = New System.Drawing.Point(611, 40)
        Me.FraChannel.Name = "FraChannel"
        Me.FraChannel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.FraChannel.Size = New System.Drawing.Size(121, 153)
        Me.FraChannel.TabIndex = 19
        Me.FraChannel.TabStop = False
        Me.FraChannel.Text = "Channel"
        '
        '_cmdFunctionRequest_4
        '
        Me._cmdFunctionRequest_4.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_4.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_4, CType(4, Short))
        Me._cmdFunctionRequest_4.Location = New System.Drawing.Point(70, 66)
        Me._cmdFunctionRequest_4.Name = "_cmdFunctionRequest_4"
        Me._cmdFunctionRequest_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_4.Size = New System.Drawing.Size(35, 25)
        Me._cmdFunctionRequest_4.TabIndex = 21
        Me._cmdFunctionRequest_4.Text = "2"
        '
        '_cmdFunctionRequest_3
        '
        Me._cmdFunctionRequest_3.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_3.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_3, CType(3, Short))
        Me._cmdFunctionRequest_3.Location = New System.Drawing.Point(19, 66)
        Me._cmdFunctionRequest_3.Name = "_cmdFunctionRequest_3"
        Me._cmdFunctionRequest_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_3.Size = New System.Drawing.Size(35, 25)
        Me._cmdFunctionRequest_3.TabIndex = 20
        Me._cmdFunctionRequest_3.Text = "1"
        '
        'Label9
        '
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label9.Location = New System.Drawing.Point(8, 21)
        Me.Label9.Name = "Label9"
        Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label9.Size = New System.Drawing.Size(105, 32)
        Me.Label9.TabIndex = 44
        Me.Label9.Text = "(Available only for 2-channel card)"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        '_lblConnectedCounter_4
        '
        Me._lblConnectedCounter_4.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_4.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_4.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_4, CType(4, Short))
        Me._lblConnectedCounter_4.Location = New System.Drawing.Point(70, 116)
        Me._lblConnectedCounter_4.Name = "_lblConnectedCounter_4"
        Me._lblConnectedCounter_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_4.Size = New System.Drawing.Size(35, 21)
        Me._lblConnectedCounter_4.TabIndex = 24
        Me._lblConnectedCounter_4.Text = "0"
        Me._lblConnectedCounter_4.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        '_lblConnectedCounter_3
        '
        Me._lblConnectedCounter_3.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_3.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_3.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_3, CType(3, Short))
        Me._lblConnectedCounter_3.Location = New System.Drawing.Point(19, 116)
        Me._lblConnectedCounter_3.Name = "_lblConnectedCounter_3"
        Me._lblConnectedCounter_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_3.Size = New System.Drawing.Size(35, 21)
        Me._lblConnectedCounter_3.TabIndex = 23
        Me._lblConnectedCounter_3.Text = "0"
        Me._lblConnectedCounter_3.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label2.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label2.Location = New System.Drawing.Point(8, 96)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(116, 16)
        Me.Label2.TabIndex = 22
        Me.Label2.Text = """Connected"" Counters"
        '
        'cmdResetCounters
        '
        Me.cmdResetCounters.BackColor = System.Drawing.SystemColors.Control
        Me.cmdResetCounters.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdResetCounters.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdResetCounters.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdResetCounters.Location = New System.Drawing.Point(612, 416)
        Me.cmdResetCounters.Name = "cmdResetCounters"
        Me.cmdResetCounters.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdResetCounters.Size = New System.Drawing.Size(123, 25)
        Me.cmdResetCounters.TabIndex = 18
        Me.cmdResetCounters.Text = "Reset Counters"
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.SystemColors.Control
        Me.Frame3.Controls.Add(Me.fraSetPoint)
        Me.Frame3.Controls.Add(Me.Frame4)
        Me.Frame3.Controls.Add(Me._cmdFunctionRequest_2)
        Me.Frame3.Controls.Add(Me.Label3)
        Me.Frame3.Controls.Add(Me._lblConnectedCounter_2)
        Me.Frame3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame3.Location = New System.Drawing.Point(314, 40)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(265, 113)
        Me.Frame3.TabIndex = 10
        Me.Frame3.TabStop = False
        Me.Frame3.Text = "SetOutput"
        '
        'fraSetPoint
        '
        Me.fraSetPoint.BackColor = System.Drawing.SystemColors.Control
        Me.fraSetPoint.Controls.Add(Me.txtSetPoint)
        Me.fraSetPoint.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.fraSetPoint.ForeColor = System.Drawing.SystemColors.ControlText
        Me.fraSetPoint.Location = New System.Drawing.Point(112, 17)
        Me.fraSetPoint.Name = "fraSetPoint"
        Me.fraSetPoint.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.fraSetPoint.Size = New System.Drawing.Size(73, 33)
        Me.fraSetPoint.TabIndex = 16
        Me.fraSetPoint.TabStop = False
        Me.fraSetPoint.Text = "Set Point"
        '
        'Frame4
        '
        Me.Frame4.BackColor = System.Drawing.SystemColors.Control
        Me.Frame4.Controls.Add(Me.txtOutStatus)
        Me.Frame4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame4.Location = New System.Drawing.Point(16, 17)
        Me.Frame4.Name = "Frame4"
        Me.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame4.Size = New System.Drawing.Size(73, 33)
        Me.Frame4.TabIndex = 14
        Me.Frame4.TabStop = False
        Me.Frame4.Text = "Out Status"
        '
        'txtOutStatus
        '
        Me.txtOutStatus.AcceptsReturn = True
        Me.txtOutStatus.AutoSize = False
        Me.txtOutStatus.BackColor = System.Drawing.SystemColors.Window
        Me.txtOutStatus.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtOutStatus.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.txtOutStatus.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtOutStatus.Location = New System.Drawing.Point(8, 13)
        Me.txtOutStatus.MaxLength = 0
        Me.txtOutStatus.Name = "txtOutStatus"
        Me.txtOutStatus.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtOutStatus.Size = New System.Drawing.Size(57, 19)
        Me.txtOutStatus.TabIndex = 15
        Me.txtOutStatus.Text = ""
        Me.txtOutStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        '_cmdFunctionRequest_2
        '
        Me._cmdFunctionRequest_2.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_2, CType(2, Short))
        Me._cmdFunctionRequest_2.Location = New System.Drawing.Point(208, 24)
        Me._cmdFunctionRequest_2.Name = "_cmdFunctionRequest_2"
        Me._cmdFunctionRequest_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_2.Size = New System.Drawing.Size(41, 29)
        Me._cmdFunctionRequest_2.TabIndex = 11
        Me._cmdFunctionRequest_2.Text = "Do"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.BackColor = System.Drawing.SystemColors.Control
        Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label3.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(98, 64)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(110, 16)
        Me.Label3.TabIndex = 13
        Me.Label3.Text = """Connected"" Counter"
        '
        '_lblConnectedCounter_2
        '
        Me._lblConnectedCounter_2.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_2.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_2, CType(2, Short))
        Me._lblConnectedCounter_2.Location = New System.Drawing.Point(108, 84)
        Me._lblConnectedCounter_2.Name = "_lblConnectedCounter_2"
        Me._lblConnectedCounter_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_2.Size = New System.Drawing.Size(81, 21)
        Me._lblConnectedCounter_2.TabIndex = 12
        Me._lblConnectedCounter_2.Text = "0"
        Me._lblConnectedCounter_2.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'fraGetFastSampling1
        '
        Me.fraGetFastSampling1.BackColor = System.Drawing.SystemColors.Control
        Me.fraGetFastSampling1.Controls.Add(Me.optShort)
        Me.fraGetFastSampling1.Controls.Add(Me.optLong)
        Me.fraGetFastSampling1.Controls.Add(Me._cmdFunctionRequest_1)
        Me.fraGetFastSampling1.Controls.Add(Me.Label5)
        Me.fraGetFastSampling1.Controls.Add(Me._lblConnectedCounter_1)
        Me.fraGetFastSampling1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.fraGetFastSampling1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.fraGetFastSampling1.Location = New System.Drawing.Point(169, 40)
        Me.fraGetFastSampling1.Name = "fraGetFastSampling1"
        Me.fraGetFastSampling1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.fraGetFastSampling1.Size = New System.Drawing.Size(145, 113)
        Me.fraGetFastSampling1.TabIndex = 6
        Me.fraGetFastSampling1.TabStop = False
        Me.fraGetFastSampling1.Text = "GetFastSampling"
        '
        'optShort
        '
        Me.optShort.BackColor = System.Drawing.SystemColors.Control
        Me.optShort.Cursor = System.Windows.Forms.Cursors.Default
        Me.optShort.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.optShort.ForeColor = System.Drawing.SystemColors.ControlText
        Me.optShort.Location = New System.Drawing.Point(8, 40)
        Me.optShort.Name = "optShort"
        Me.optShort.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.optShort.Size = New System.Drawing.Size(49, 17)
        Me.optShort.TabIndex = 31
        Me.optShort.TabStop = True
        Me.optShort.Text = "Short"
        '
        'optLong
        '
        Me.optLong.BackColor = System.Drawing.SystemColors.Control
        Me.optLong.Checked = True
        Me.optLong.Cursor = System.Windows.Forms.Cursors.Default
        Me.optLong.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.optLong.ForeColor = System.Drawing.SystemColors.ControlText
        Me.optLong.Location = New System.Drawing.Point(8, 16)
        Me.optLong.Name = "optLong"
        Me.optLong.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.optLong.Size = New System.Drawing.Size(49, 17)
        Me.optLong.TabIndex = 30
        Me.optLong.TabStop = True
        Me.optLong.Text = "Long"
        '
        '_cmdFunctionRequest_1
        '
        Me._cmdFunctionRequest_1.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_1, CType(1, Short))
        Me._cmdFunctionRequest_1.Location = New System.Drawing.Point(76, 24)
        Me._cmdFunctionRequest_1.Name = "_cmdFunctionRequest_1"
        Me._cmdFunctionRequest_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_1.Size = New System.Drawing.Size(41, 29)
        Me._cmdFunctionRequest_1.TabIndex = 7
        Me._cmdFunctionRequest_1.Text = "Do"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.BackColor = System.Drawing.SystemColors.Control
        Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label5.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label5.Location = New System.Drawing.Point(19, 64)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(110, 16)
        Me.Label5.TabIndex = 9
        Me.Label5.Text = """Connected"" Counter"
        '
        '_lblConnectedCounter_1
        '
        Me._lblConnectedCounter_1.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_1.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_1, CType(1, Short))
        Me._lblConnectedCounter_1.Location = New System.Drawing.Point(29, 84)
        Me._lblConnectedCounter_1.Name = "_lblConnectedCounter_1"
        Me._lblConnectedCounter_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_1.Size = New System.Drawing.Size(81, 21)
        Me._lblConnectedCounter_1.TabIndex = 8
        Me._lblConnectedCounter_1.Text = "0"
        Me._lblConnectedCounter_1.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.Add(Me.cmdAuto)
        Me.Frame1.Controls.Add(Me._cmdFunctionRequest_0)
        Me.Frame1.Controls.Add(Me._lblConnectedCounter_0)
        Me.Frame1.Controls.Add(Me.Label1)
        Me.Frame1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(24, 40)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(145, 113)
        Me.Frame1.TabIndex = 2
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "GetRTStatus"
        '
        'cmdAuto
        '
        Me.cmdAuto.BackColor = System.Drawing.SystemColors.Control
        Me.cmdAuto.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdAuto.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdAuto.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdAuto.Location = New System.Drawing.Point(70, 24)
        Me.cmdAuto.Name = "cmdAuto"
        Me.cmdAuto.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdAuto.Size = New System.Drawing.Size(41, 29)
        Me.cmdAuto.TabIndex = 25
        Me.cmdAuto.Text = "Auto"
        '
        '_cmdFunctionRequest_0
        '
        Me._cmdFunctionRequest_0.BackColor = System.Drawing.SystemColors.Control
        Me._cmdFunctionRequest_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._cmdFunctionRequest_0.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._cmdFunctionRequest_0.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdFunctionRequest.SetIndex(Me._cmdFunctionRequest_0, CType(0, Short))
        Me._cmdFunctionRequest_0.Location = New System.Drawing.Point(29, 24)
        Me._cmdFunctionRequest_0.Name = "_cmdFunctionRequest_0"
        Me._cmdFunctionRequest_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._cmdFunctionRequest_0.Size = New System.Drawing.Size(41, 29)
        Me._cmdFunctionRequest_0.TabIndex = 4
        Me._cmdFunctionRequest_0.Text = "Do"
        '
        '_lblConnectedCounter_0
        '
        Me._lblConnectedCounter_0.BackColor = System.Drawing.SystemColors.Control
        Me._lblConnectedCounter_0.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me._lblConnectedCounter_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._lblConnectedCounter_0.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me._lblConnectedCounter_0.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblConnectedCounter.SetIndex(Me._lblConnectedCounter_0, CType(0, Short))
        Me._lblConnectedCounter_0.Location = New System.Drawing.Point(29, 84)
        Me._lblConnectedCounter_0.Name = "_lblConnectedCounter_0"
        Me._lblConnectedCounter_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._lblConnectedCounter_0.Size = New System.Drawing.Size(81, 21)
        Me._lblConnectedCounter_0.TabIndex = 5
        Me._lblConnectedCounter_0.Text = "0"
        Me._lblConnectedCounter_0.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(19, 64)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(110, 16)
        Me.Label1.TabIndex = 3
        Me.Label1.Text = """Connected"" Counter"
        '
        'txtIP
        '
        Me.txtIP.AcceptsReturn = True
        Me.txtIP.AutoSize = False
        Me.txtIP.BackColor = System.Drawing.SystemColors.Window
        Me.txtIP.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtIP.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.txtIP.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtIP.Location = New System.Drawing.Point(106, 4)
        Me.txtIP.MaxLength = 0
        Me.txtIP.Name = "txtIP"
        Me.txtIP.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtIP.Size = New System.Drawing.Size(101, 24)
        Me.txtIP.TabIndex = 0
        Me.txtIP.Text = "255.255.255.0"
        Me.txtIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'tcpClient
        '
        Me.tcpClient.Enabled = True
        Me.tcpClient.Location = New System.Drawing.Point(580, 166)
        Me.tcpClient.Name = "tcpClient"
        Me.tcpClient.OcxState = CType(resources.GetObject("tcpClient.OcxState"), System.Windows.Forms.AxHost.State)
        Me.tcpClient.Size = New System.Drawing.Size(28, 28)
        Me.tcpClient.TabIndex = 46
        '
        'lblIntegrationData
        '
        Me.lblIntegrationData.BackColor = System.Drawing.SystemColors.Control
        Me.lblIntegrationData.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblIntegrationData.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblIntegrationData.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.lblIntegrationData.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblIntegrationData.Location = New System.Drawing.Point(682, 6)
        Me.lblIntegrationData.Name = "lblIntegrationData"
        Me.lblIntegrationData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblIntegrationData.Size = New System.Drawing.Size(25, 23)
        Me.lblIntegrationData.TabIndex = 43
        Me.lblIntegrationData.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'lblIntegration
        '
        Me.lblIntegration.BackColor = System.Drawing.SystemColors.Control
        Me.lblIntegration.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblIntegration.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.lblIntegration.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblIntegration.Location = New System.Drawing.Point(610, 8)
        Me.lblIntegration.Name = "lblIntegration"
        Me.lblIntegration.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblIntegration.Size = New System.Drawing.Size(69, 19)
        Me.lblIntegration.TabIndex = 42
        Me.lblIntegration.Text = "Integration:"
        Me.lblIntegration.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'lblUnit
        '
        Me.lblUnit.AutoSize = True
        Me.lblUnit.BackColor = System.Drawing.SystemColors.Control
        Me.lblUnit.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblUnit.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblUnit.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblUnit.Location = New System.Drawing.Point(424, 10)
        Me.lblUnit.Name = "lblUnit"
        Me.lblUnit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblUnit.Size = New System.Drawing.Size(24, 16)
        Me.lblUnit.TabIndex = 41
        Me.lblUnit.Text = "Unit"
        Me.lblUnit.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'lblA2D
        '
        Me.lblA2D.BackColor = System.Drawing.SystemColors.Control
        Me.lblA2D.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblA2D.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblA2D.Font = New System.Drawing.Font("Arial", 13.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.lblA2D.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblA2D.Location = New System.Drawing.Point(494, 2)
        Me.lblA2D.Name = "lblA2D"
        Me.lblA2D.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblA2D.Size = New System.Drawing.Size(83, 29)
        Me.lblA2D.TabIndex = 40
        Me.lblA2D.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.BackColor = System.Drawing.SystemColors.Control
        Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label8.Location = New System.Drawing.Point(470, 10)
        Me.Label8.Name = "Label8"
        Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label8.Size = New System.Drawing.Size(25, 16)
        Me.Label8.TabIndex = 39
        Me.Label8.Text = "A/D:"
        '
        'lblWeight
        '
        Me.lblWeight.BackColor = System.Drawing.SystemColors.Control
        Me.lblWeight.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblWeight.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblWeight.Font = New System.Drawing.Font("Tahoma", 18.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
        Me.lblWeight.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblWeight.Location = New System.Drawing.Point(266, 2)
        Me.lblWeight.Name = "lblWeight"
        Me.lblWeight.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblWeight.Size = New System.Drawing.Size(153, 32)
        Me.lblWeight.TabIndex = 38
        Me.lblWeight.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'Label7
        '
        Me.Label7.AutoSize = True
        Me.Label7.BackColor = System.Drawing.SystemColors.Control
        Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label7.Location = New System.Drawing.Point(226, 10)
        Me.Label7.Name = "Label7"
        Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label7.Size = New System.Drawing.Size(41, 16)
        Me.Label7.TabIndex = 37
        Me.Label7.Text = "Weight:"
        '
        'lblServerAddress
        '
        Me.lblServerAddress.BackColor = System.Drawing.SystemColors.Control
        Me.lblServerAddress.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblServerAddress.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblServerAddress.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblServerAddress.Location = New System.Drawing.Point(22, 6)
        Me.lblServerAddress.Name = "lblServerAddress"
        Me.lblServerAddress.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblServerAddress.Size = New System.Drawing.Size(83, 17)
        Me.lblServerAddress.TabIndex = 1
        Me.lblServerAddress.Text = "Server Address:"
        Me.lblServerAddress.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'cmdFunctionRequest
        '
        '
        'frmClient
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(755, 515)
        Me.Controls.Add(Me.fraGetFastSampling2)
        Me.Controls.Add(Me.Frame8)
        Me.Controls.Add(Me.rtfFeedback)
        Me.Controls.Add(Me.Frame7)
        Me.Controls.Add(Me.FraChannel)
        Me.Controls.Add(Me.cmdResetCounters)
        Me.Controls.Add(Me.Frame3)
        Me.Controls.Add(Me.fraGetFastSampling1)
        Me.Controls.Add(Me.Frame1)
        Me.Controls.Add(Me.txtIP)
        Me.Controls.Add(Me.tcpClient)
        Me.Controls.Add(Me.lblIntegrationData)
        Me.Controls.Add(Me.lblIntegration)
        Me.Controls.Add(Me.lblUnit)
        Me.Controls.Add(Me.lblA2D)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.lblWeight)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.lblServerAddress)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Location = New System.Drawing.Point(3, 29)
        Me.MaximizeBox = False
        Me.Name = "frmClient"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "Tcp Client: Programmer's Example"
        Me.fraGetFastSampling2.ResumeLayout(False)
        Me.Frame8.ResumeLayout(False)
        CType(Me.rtfFeedback, System.ComponentModel.ISupportInitialize).EndInit()
        Me.Frame7.ResumeLayout(False)
        Me.FraChannel.ResumeLayout(False)
        Me.Frame3.ResumeLayout(False)
        Me.fraSetPoint.ResumeLayout(False)
        Me.Frame4.ResumeLayout(False)
        Me.fraGetFastSampling1.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        CType(Me.tcpClient, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.cmdFunctionRequest, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.lblConnectedCounter, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As frmClient
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmClient
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmClient()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private Declare Sub Sleep Lib "KERNEL32" (ByVal dwMilliseconds As Integer)
	' The mechanism of conversation with the server (=the card) is like this:
	' 1. cmdFunctionRequest_Click: "Connect" method (tcpClient.Connect, via Sub DoConnect).
	' 2. System:                   "Connect" event (tcpClient_Connect).
	' 3. "Connect" event:          "SendData" method (tcpClient.SendData, via Sub SendRequest).
	' 4. System:                   "DataArrival" event (tcpClient_DataArrival).
	' Note:
	' In case of GetFastSampling, which requires a continuous conversation, Sub DoConnect
	' is called again in Sub ProcessDataArrived, in order to have an additional cycle of
	' the above sequence.
	
	Const GREY As Integer = &H8000000F
	
	Const MAX_FUNCTIONS As Short = 18
	
	' Functions:
	Const GetRTStatus As Short = 0
	Const GetFastSampling As Short = 1
	Const SetOutput As Short = 2
	Const ch1_switch As Short = 3
	Const ch2_switch As Short = 4
	Const StartSample As Short = 5
	Const StopSample As Short = 6
	
	' Error Codes:
	Const OUT_OF_RANGE As Short = 21
	Const END_OF_FILE As Short = 200
	Const DOUBLE_START As Short = 201
	Const DOUBLE_STOP As Short = 202
	
	Const IPFileName As String = "LastIP.txt"
	
	Dim FunctionName(MAX_FUNCTIONS) As String
	Dim CurrentFunction As Short
	Dim AutoFlag As Boolean
	Dim DataArriving As Boolean
	Dim DataPhase As Short ' 0 - looking for the 'start' tag
	' 1 - looking for the 'close' tag
	Dim XMLString As String
	Dim FastSamplingInProgress As Boolean
	Dim StopSamplingRequested As Boolean
	Dim ConnectedCounter(MAX_FUNCTIONS) As Integer
	Dim ActiveChannel As Short
	Sub DoConnect()
		' A general routine to establish connection with the server:
		tcpClient.Close()
		tcpClient.Connect(txtIP.Text, 80) ' (remotePort = 80 means HTTP.)
		Call RenewTimeout() '  Restart a new time-out countdown.
	End Sub
	' SendRequest is a general routine to send a request string to the server:
	Sub SendRequest(ByRef FunctionName As String, ByRef Parameters As String)
		Dim RequestString As String
		RequestString = "POST /" & FunctionName & vbCrLf & "Content-Length: " & Len(Parameters) & vbCrLf & vbCrLf & Parameters & vbCrLf
		tcpClient.SendData(RequestString)
	End Sub
	Sub ProcessDataArrived()
		Dim Weight As String
		Dim A2D As String
		Dim EnableAgain As Boolean
		Dim ErrCode As String
		Dim Channel As String
		Dim Integration As String
		Dim Unit As String
		
		Static AllStrings As String
		Static SamplingBeingStopped As Boolean
		
		' Display XML data:
		If (CurrentFunction = GetFastSampling And optLong.Checked) Then
			' GetFastSampling in 'Long' mode - don't refresh display yet, as it will be
			' shown upon the completion of ALL blocks.
		Else
			' Display the data arrived. Add C/R & L/F between fields,
			' in order to improve readability:
			rtfFeedback.Text = Replace(XMLString, "><", ">" & vbCrLf & "<")
		End If
		
		ErrCode = ExtractValue(XMLString, "ERROR_CODE")
		EnableAgain = True ' Default. If necessary, will be reversed.
		Select Case CurrentFunction
			Case GetRTStatus
				If Val(ErrCode) = OUT_OF_RANGE Then
					lblWeight.Text = "Out of Range"
					lblWeight.BackColor = System.Drawing.Color.Red
				Else
					Weight = ExtractValue(XMLString, "WEIGHT")
					lblWeight.Text = VB6.Format(Val(Weight), "0.000")
					lblWeight.BackColor = System.Drawing.ColorTranslator.FromOle(GREY)
				End If
				
				A2D = ExtractValue(XMLString, "A2D")
				lblA2D.Text = A2D
				
				Channel = ExtractValue(XMLString, "CHANNEL")
				Select Case Channel
					Case "1"
						ActiveChannel = 1
						cmdFunctionRequest(ch1_switch).BackColor = System.Drawing.Color.Yellow ' Turn on button of channel 1...
						cmdFunctionRequest(ch2_switch).BackColor = System.Drawing.ColorTranslator.FromOle(GREY) ' ...and off the button of channel 2.
					Case "2"
						ActiveChannel = 2
						cmdFunctionRequest(ch2_switch).BackColor = System.Drawing.Color.Yellow ' Turn on button of channel 2...
						cmdFunctionRequest(ch1_switch).BackColor = System.Drawing.ColorTranslator.FromOle(GREY) ' ...and off the button of channel 1.
				End Select
				
				Unit = ExtractValue(XMLString, "UNIT")
				lblUnit.Text = Unit
				
				Integration = ExtractValue(XMLString, "INTEGRATION")
				lblIntegrationData.Text = Integration
				
				If AutoFlag Then
					Call DoConnect() ' Produce a new 'GetRTStatus' request
					EnableAgain = False
				End If
				
			Case GetFastSampling
				' Accumulate XML response:
				AllStrings = AllStrings & XMLString
				If (optShort.Checked And SamplingBeingStopped = False) Then
					' The user selected the 'Short' option, and the first GetFastSampling
					' is completed; so, signal that StopSample is required, in order to take
					' the card out of the 'Fast Sampling' mode:
					StopSamplingRequested = True
					SamplingBeingStopped = True
				End If
				If Val(ErrCode) = END_OF_FILE Then
					' End of all data:
					FastSamplingInProgress = False
					SamplingBeingStopped = False
					rtfFeedback.Text = Replace(AllStrings, "><", ">" & vbCrLf & "<")
				Else
					' Data still available
					If StopSamplingRequested Then
						' Now honour the 'StopSampling' request:
						CurrentFunction = StopSample
						StopSamplingRequested = False
					Else
						' CurrentFunction already = GetFastSampling;
						' next block will be retrieved.
					End If
					EnableAgain = False
					Call DoConnect() ' Produce a new request (GetFastSampling or StopSampling)
				End If
				
			Case ch1_switch, ch2_switch
				Sleep((400)) ' Dead time. See manual section 5.1.3/5.1.4:
				' Wait 400ms after getting response on ch1_switch/ch2_switch before
				' sending the next function request to the card.
				CurrentFunction = GetRTStatus
				Call DoConnect()
				EnableAgain = False
				
			Case 5 ' StartSample
				' StartSample completed, now launch a GetFastSampling request.
				' This request is the first in a SERIES of 'GetFastSampling' requests.
				' In case of 'Short', this first 'GetFastSampling' request will be
				' followed by a 'StopSample' request that will be produced in 'Case 1'.
				' In either case (Short or Long), the subsequent requests will be produced
				' in 'Case 1'.
				CurrentFunction = GetFastSampling
				Call DoConnect()
				EnableAgain = False
				AllStrings = XMLString ' Keep the response on StartSample.
				
			Case 6 ' StopSample
				' StopSample completed
				If FastSamplingInProgress Then
					' Add the 'StopSample' response to the full string:
					AllStrings = AllStrings & XMLString
					CurrentFunction = GetFastSampling ' Resume the 'GetFastSampling' series
					Call DoConnect()
					EnableAgain = False
				End If
		End Select
		
		If EnableAgain Then
			EnableAllButtons((True))
			cmdAuto.Enabled = True
		End If
		tmrTimeout.Enabled = False
	End Sub
	Sub RenewTimeout()
		' This routine stops the current tmrTimeout countdown (if there was such),
		' and restarts a new countdown:
		
		' Following two lines might look strange; however, as the first disables the timer
		' and the seconds re-enables it, the effect is restart the countdown from timer's
		' specified Interval property; in other words - renew the countdown.
		tmrTimeout.Enabled = False
		tmrTimeout.Enabled = True
	End Sub
	Private Sub cmdAuto_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdAuto.Click
		AutoFlag = Not AutoFlag
		If AutoFlag Then
			cmdAuto.BackColor = System.Drawing.Color.Yellow
			cmdAuto.Text = "Stop"
			If cmdFunctionRequest(GetRTStatus).Enabled Then Call cmdFunctionRequest_Click(cmdFunctionRequest.Item(GetRTStatus), New System.EventArgs()) ' Start the loop
			EnableAllButtons((False))
		Else
			cmdAuto.BackColor = System.Drawing.ColorTranslator.FromOle(GREY)
			cmdAuto.Text = "Auto"
			EnableAllButtons((True))
		End If
	End Sub
	Private Sub frmClient_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		FunctionName(GetRTStatus) = "GetRTStatus"
		FunctionName(GetFastSampling) = "GetFastSampling"
		FunctionName(SetOutput) = "SetOutput"
		FunctionName(ch1_switch) = "ch1_switch"
		FunctionName(ch2_switch) = "ch2_switch"
		FunctionName(StartSample) = "StartSample"
		FunctionName(StopSample) = "StopSample"
		
		tcpClient.Protocol = MSWinsockLib.ProtocolConstants.sckTCPProtocol
		Call LoadLastIPAddress()
		lblUnit.Text = ""
		
		' Initialize the 'GetFastSampling' frame. It will be displayed when we are
		' in channel #2, where 'GetFastSampling' function is not available:
		fraGetFastSampling2.Top = fraGetFastSampling1.Top
		fraGetFastSampling2.Left = fraGetFastSampling1.Left
		fraGetFastSampling2.Height = fraGetFastSampling1.Height
		fraGetFastSampling2.Width = fraGetFastSampling1.Width
		
		lblOnlyChannel1.Top = VB6.TwipsToPixelsY(540)
		lblOnlyChannel1.Left = VB6.TwipsToPixelsX(60)
		lblOnlyChannel1.Height = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(fraGetFastSampling1.Height) - 600)
		lblOnlyChannel1.Width = VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(fraGetFastSampling1.Width) - 120)
		lblOnlyChannel1.Text = "Available for channel #1 only"
		
		' As initially we are in the dark, we have to display the message as if
		' we are in channel #2. The first 'GetRTStatus' activation will cause
		' the proper display to be shown. However, an automatic 'GetRTStatus' on
		' initialization is undesirable, as the initial IP address may be wrong,
		' and a puzzling 'timeout' error would appear.
		fraGetFastSampling2.Visible = True
		fraGetFastSampling1.Visible = False
	End Sub
	Private Sub cmdResetCounters_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdResetCounters.Click
		' Clear all "Connected" Counters:
		Dim i As Short
		rtfFeedback.Text = ""
		On Error GoTo End_Sub
		For i = 0 To MAX_FUNCTIONS
			' Clear and display the proper "Connected" Counter:
			ConnectedCounter(i) = 0
			lblConnectedCounter(i).Text = CStr(ConnectedCounter(i))
		Next 
End_Sub: 
	End Sub
	Sub EnableAllButtons(ByRef TrueOrFalse As Boolean)
		' Enable (TrueOrFalse=True) or disable (TrueOrFalse=False) all 'cmdFunctionRequest' buttons:
		Dim i As Short
		
		Select Case ActiveChannel
			Case 1
				fraGetFastSampling1.Visible = True
				fraGetFastSampling2.Visible = False
			Case 2
				fraGetFastSampling2.Visible = True
				fraGetFastSampling1.Visible = False
		End Select
		
		cmdResetCounters.Enabled = TrueOrFalse
		On Error GoTo End_Sub
		For i = 0 To MAX_FUNCTIONS
			cmdFunctionRequest(i).Enabled = TrueOrFalse
		Next 
End_Sub: 
	End Sub
	Private Sub cmdFunctionRequest_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFunctionRequest.Click
		Dim Index As Short = cmdFunctionRequest.GetIndex(eventSender)
		EnableAllButtons((False)) ' (to disable recursion)
		cmdAuto.Enabled = AutoFlag
		If AutoFlag = False Then rtfFeedback.Text = "" ' Clear the 'feedback' box
		' Save current index to enable later return the proper 'Enabled' property:
		Select Case Index
			Case GetFastSampling
				' User requests GetFastSampling. We'll first supply automatically
				' a StartSample request; only by its completion, we'll send the
				' GetFastSampling request:
				
				CurrentFunction = StartSample
				FastSamplingInProgress = True
				If optLong.Checked Then cmdFunctionRequest(StopSample).Enabled = True
				
			Case StopSample
				If FastSamplingInProgress Then
					' Postpone the honouring of this request, in order to be synchronized.
					StopSamplingRequested = True
					Exit Sub
				Else
					CurrentFunction = Index
				End If
				
			Case Else
				CurrentFunction = Index
		End Select
		Call DoConnect()
	End Sub
	Private Sub tcpClient_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tcpClient.ConnectEvent
		Dim Parameters As String
		
		' Increment and display the proper "Connected" Counter:
		ConnectedCounter(CurrentFunction) = ConnectedCounter(CurrentFunction) + 1
		lblConnectedCounter(CurrentFunction).Text = CStr(ConnectedCounter(CurrentFunction))
		Select Case CurrentFunction
			Case SetOutput
				Parameters = "ID=1&OUT_STATUS=" & txtOutStatus.Text & "&SET_POINT=" & txtSetPoint.Text
				' Note that the '&' marks INSIDE quotation marks are part of
				' the text, whereas the others are VB 'concatenation marks'.
				
			Case Else
				Parameters = "ID=1"
		End Select
		
		Call SendRequest(FunctionName(CurrentFunction), Parameters)
	End Sub
	Private Sub tcpClient_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles tcpClient.DataArrival
		' This function does the following:
		' 1. Receives the new data portion.
		' 2. Accumulates it into the full string.
		' 3. Checks the full string, and if it's found complete, then:
		'    * Processes the data arrived.
		'    * Resets the full string.
		
		'UPGRADE_NOTE: Tag was upgraded to Tag_Renamed. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'
		Static Tag_Renamed As String ' The root tag of the package.
		Static TagLen As Short ' The length of Tag.
		
		Dim NewPortion As String
		Dim QMLocation As Short ' Location of the '?' (of '?><')
		Dim CloseTagLocation As Short ' Location of the 'close' tag
		Dim TagBeginning As Short
		Dim TagEnd As Short
		
		DataArriving = True
		Call RenewTimeout() '  Restart a new time-out countdown.
		tcpClient.GetData(NewPortion, VariantType.String) ' Read the new portion of the data.
		' Accumulate the new data portion into the full string:
		XMLString = XMLString & NewPortion
		If DataPhase = 0 Then
			' Still looking for the 'start' tag:
			QMLocation = InStr(1, XMLString, "?><")
			If QMLocation = 0 Then
				Exit Sub ' No 'start' tag yet.
			End If
			
			' 'Start' tag recognized:
			' * Identify the tag.
			' * Proceed to next phase (= looking for the 'close' tag).
			TagBeginning = QMLocation + 3
			TagEnd = InStr(TagBeginning + 1, XMLString, " ") - 1
			TagLen = TagEnd - TagBeginning + 1
			Tag_Renamed = Mid(XMLString, TagBeginning, TagLen)
			DataPhase = 1 ' Now looking for the 'close' tag.
			' Note that the closing tag may be already in current portion of text,
			' so we have to check it either, therefore the "Looking for the 'close' tag"
			' (below) is NOT conditioned on DataPhase.
		End If
		' Looking for the 'close' tag:
		CloseTagLocation = InStr(VB.Right(XMLString, TagLen + 20), "/" & Tag_Renamed)
		If CloseTagLocation = 0 Then Exit Sub ' Current transmission not complete yet.
		
		' Current transmission is complete - process it:
		Call ProcessDataArrived()
		' Reset XMLString, DataPhase & DataArriving:
		XMLString = ""
		DataPhase = 0
		DataArriving = False
		
	End Sub
	Private Sub tcpClient_Error(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_ErrorEvent) Handles tcpClient.Error
		Const TIME_OUT As Short = 10060
		If eventArgs.Number = TIME_OUT Then
			If tmrTimeout.Enabled Then
				' Error not reported yet. Report now & abort the timer:
				eventArgs.CancelDisplay = False
				tmrTimeout.Enabled = False
			Else
				' Error already reported, no need to report again:
				eventArgs.CancelDisplay = True
			End If
		Else
			eventArgs.CancelDisplay = False ' Let system display the error message.
		End If
		tcpClient.Close()
		EnableAllButtons((True))
		cmdAuto.Enabled = True
	End Sub
	Private Sub tmrTimeout_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrTimeout.Tick
		If DataArriving Then
			Call MsgBox("No closing tag.", MsgBoxStyle.Exclamation, "Timeout: Unexpected end of data")
			DataArriving = False
		Else
			Call MsgBox("No input has arrived.", MsgBoxStyle.Exclamation, "Timeout: No response")
		End If
		tcpClient.Close()
		Call ProcessDataArrived()
		' Reset XMLString & DataPhase:
		XMLString = ""
		DataPhase = 0
		EnableAllButtons((True))
		cmdAuto.Enabled = True
		tmrTimeout.Enabled = False
	End Sub
	'UPGRADE_NOTE: Tag was upgraded to Tag_Renamed. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'
	Function ExtractValue(ByRef SourceString As String, ByRef Tag_Renamed As String) As String
		' Returns the value field of the specified Tag in SourceString (null if none).
		Dim StartLocation As Integer
		Dim EndLocation As Integer
		
		StartLocation = InStr(1, SourceString, Tag_Renamed)
		If StartLocation = 0 Then
			' No 'start' tag.
			ExtractValue = ""
			Exit Function
		End If
		StartLocation = StartLocation + Len(Tag_Renamed) + 1 ' Start location of value
		
		EndLocation = InStr(StartLocation, SourceString, "/" & Tag_Renamed)
		If EndLocation = 0 Then
			' No 'close' tag.
			ExtractValue = ""
			Exit Function
		End If
		EndLocation = EndLocation - 2 ' End location of value
		
		ExtractValue = Mid(SourceString, StartLocation, EndLocation - StartLocation + 1)
	End Function
	Public Sub SaveLastIPAddress()
		' Save the last IP address into the IP address file (see constant IPFileName):
		FileOpen(1, IPFileName, OpenMode.Output)
		PrintLine(1, txtIP.Text)
		FileClose(1)
	End Sub
	Private Sub txtIP_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtIP.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SaveLastIPAddress()
		End If
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	Private Sub txtIP_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtIP.Leave
		Call SaveLastIPAddress()
	End Sub
	Public Sub LoadLastIPAddress()
		' Load the last IP address from the IP address file (see constant IPFileName).
		' If there's no such file, produce it, writing there the default IP address.
		Dim IPFileDir As String
		Dim IPAddress As String
		
		'UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1041"'
		IPFileDir = Dir(IPFileName)
		If UCase(IPFileDir) <> UCase(IPFileName) Then
			' File does not exist, so produce it now:
			FileOpen(1, IPFileName, OpenMode.Output)
			PrintLine(1, "192.168.0.31") ' write the default IP address.
			FileClose(1)
		End If
		
		' Put the IP Address in txtIP.Text:
		FileOpen(1, IPFileName, OpenMode.Input)
		IPAddress = LineInput(1)
		txtIP.Text = IPAddress
		FileClose(1)
	End Sub
End Class