Option Strict Off
Option Explicit On 
Imports System.Runtime.InteropServices
Imports VB = Microsoft.VisualBasic
Friend Class Form1
	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 DelimBox As System.Windows.Forms.ComboBox
	Public WithEvents YradrBox As System.Windows.Forms.ComboBox
	Public WithEvents Label4 As System.Windows.Forms.Label
	Public WithEvents Frame3 As System.Windows.Forms.GroupBox
	Public WithEvents Ret_Del As System.Windows.Forms.Button
	Public WithEvents Text_Del As System.Windows.Forms.Button
	Public WithEvents TextRet As System.Windows.Forms.TextBox
	Public WithEvents Polling As System.Windows.Forms.Button
	Public WithEvents GetCmd As System.Windows.Forms.Button
	Public WithEvents Exit_Renamed As System.Windows.Forms.Button
	Public WithEvents Init As System.Windows.Forms.Button
	Public WithEvents SendData As System.Windows.Forms.TextBox
	Public WithEvents ReceiveData As System.Windows.Forms.TextBox
	Public WithEvents Receive As System.Windows.Forms.Button
	Public WithEvents Send As System.Windows.Forms.Button
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents MyAddress As System.Windows.Forms.TextBox
	Public WithEvents Label5 As System.Windows.Forms.Label
	Public WithEvents Frame2 As System.Windows.Forms.GroupBox
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Label3 As System.Windows.Forms.Label
	'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()
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.DelimBox = New System.Windows.Forms.ComboBox()
        Me.Frame3 = New System.Windows.Forms.GroupBox()
        Me.YradrBox = New System.Windows.Forms.ComboBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Ret_Del = New System.Windows.Forms.Button()
        Me.Text_Del = New System.Windows.Forms.Button()
        Me.TextRet = New System.Windows.Forms.TextBox()
        Me.Polling = New System.Windows.Forms.Button()
        Me.GetCmd = New System.Windows.Forms.Button()
        Me.Exit_Renamed = New System.Windows.Forms.Button()
        Me.Init = New System.Windows.Forms.Button()
        Me.Frame1 = New System.Windows.Forms.GroupBox()
        Me.SendData = New System.Windows.Forms.TextBox()
        Me.ReceiveData = New System.Windows.Forms.TextBox()
        Me.Receive = New System.Windows.Forms.Button()
        Me.Send = New System.Windows.Forms.Button()
        Me.Frame2 = New System.Windows.Forms.GroupBox()
        Me.MyAddress = New System.Windows.Forms.TextBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Frame3.SuspendLayout()
        Me.Frame1.SuspendLayout()
        Me.Frame2.SuspendLayout()
        Me.SuspendLayout()
        '
        'DelimBox
        '
        Me.DelimBox.BackColor = System.Drawing.SystemColors.Window
        Me.DelimBox.Cursor = System.Windows.Forms.Cursors.Default
        Me.DelimBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.DelimBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.DelimBox.ForeColor = System.Drawing.SystemColors.WindowText
        Me.DelimBox.Items.AddRange(New Object() {"Not Use", "CR+LF", "CR", "LF"})
        Me.DelimBox.Location = New System.Drawing.Point(416, 64)
        Me.DelimBox.Name = "DelimBox"
        Me.DelimBox.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.DelimBox.Size = New System.Drawing.Size(105, 21)
        Me.DelimBox.TabIndex = 19
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.SystemColors.Control
        Me.Frame3.Controls.AddRange(New System.Windows.Forms.Control() {Me.YradrBox, Me.Label4})
        Me.Frame3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, 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(192, 0)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(213, 39)
        Me.Frame3.TabIndex = 16
        Me.Frame3.TabStop = False
        '
        'YradrBox
        '
        Me.YradrBox.BackColor = System.Drawing.SystemColors.Window
        Me.YradrBox.Cursor = System.Windows.Forms.Cursors.Default
        Me.YradrBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.YradrBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.YradrBox.ForeColor = System.Drawing.SystemColors.WindowText
        Me.YradrBox.Items.AddRange(New Object() {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"})
        Me.YradrBox.Location = New System.Drawing.Point(150, 12)
        Me.YradrBox.Name = "YradrBox"
        Me.YradrBox.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.YradrBox.Size = New System.Drawing.Size(45, 21)
        Me.YradrBox.TabIndex = 17
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.SystemColors.Control
        Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label4.Location = New System.Drawing.Point(18, 16)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(131, 17)
        Me.Label4.TabIndex = 18
        Me.Label4.Text = "Address of device ="
        '
        'Ret_Del
        '
        Me.Ret_Del.BackColor = System.Drawing.SystemColors.Control
        Me.Ret_Del.Cursor = System.Windows.Forms.Cursors.Default
        Me.Ret_Del.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Ret_Del.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Ret_Del.Location = New System.Drawing.Point(198, 150)
        Me.Ret_Del.Name = "Ret_Del"
        Me.Ret_Del.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Ret_Del.Size = New System.Drawing.Size(103, 21)
        Me.Ret_Del.TabIndex = 12
        Me.Ret_Del.Text = "&Del Return"
        '
        'Text_Del
        '
        Me.Text_Del.BackColor = System.Drawing.SystemColors.Control
        Me.Text_Del.Cursor = System.Windows.Forms.Cursors.Default
        Me.Text_Del.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Text_Del.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Text_Del.Location = New System.Drawing.Point(306, 150)
        Me.Text_Del.Name = "Text_Del"
        Me.Text_Del.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Text_Del.Size = New System.Drawing.Size(99, 21)
        Me.Text_Del.TabIndex = 11
        Me.Text_Del.Text = "D&el Data"
        '
        'TextRet
        '
        Me.TextRet.AcceptsReturn = True
        Me.TextRet.AutoSize = False
        Me.TextRet.BackColor = System.Drawing.SystemColors.Window
        Me.TextRet.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.TextRet.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TextRet.ForeColor = System.Drawing.SystemColors.WindowText
        Me.TextRet.Location = New System.Drawing.Point(8, 176)
        Me.TextRet.MaxLength = 0
        Me.TextRet.Name = "TextRet"
        Me.TextRet.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.TextRet.Size = New System.Drawing.Size(393, 24)
        Me.TextRet.TabIndex = 10
        Me.TextRet.Text = ""
        '
        'Polling
        '
        Me.Polling.BackColor = System.Drawing.SystemColors.Control
        Me.Polling.Cursor = System.Windows.Forms.Cursors.Default
        Me.Polling.Enabled = False
        Me.Polling.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Polling.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Polling.Location = New System.Drawing.Point(412, 96)
        Me.Polling.Name = "Polling"
        Me.Polling.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Polling.Size = New System.Drawing.Size(109, 31)
        Me.Polling.TabIndex = 9
        Me.Polling.Text = "&Polling"
        '
        'GetCmd
        '
        Me.GetCmd.BackColor = System.Drawing.SystemColors.Control
        Me.GetCmd.Cursor = System.Windows.Forms.Cursors.Default
        Me.GetCmd.Enabled = False
        Me.GetCmd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.GetCmd.ForeColor = System.Drawing.SystemColors.ControlText
        Me.GetCmd.Location = New System.Drawing.Point(412, 136)
        Me.GetCmd.Name = "GetCmd"
        Me.GetCmd.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.GetCmd.Size = New System.Drawing.Size(109, 31)
        Me.GetCmd.TabIndex = 8
        Me.GetCmd.Text = "&GET"
        '
        'Exit_Renamed
        '
        Me.Exit_Renamed.BackColor = System.Drawing.SystemColors.Control
        Me.Exit_Renamed.Cursor = System.Windows.Forms.Cursors.Default
        Me.Exit_Renamed.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Exit_Renamed.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Exit_Renamed.Location = New System.Drawing.Point(412, 176)
        Me.Exit_Renamed.Name = "Exit_Renamed"
        Me.Exit_Renamed.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Exit_Renamed.Size = New System.Drawing.Size(109, 31)
        Me.Exit_Renamed.TabIndex = 7
        Me.Exit_Renamed.Text = "E&xit"
        '
        'Init
        '
        Me.Init.BackColor = System.Drawing.SystemColors.Control
        Me.Init.Cursor = System.Windows.Forms.Cursors.Default
        Me.Init.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Init.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Init.Location = New System.Drawing.Point(412, 8)
        Me.Init.Name = "Init"
        Me.Init.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Init.Size = New System.Drawing.Size(109, 31)
        Me.Init.TabIndex = 6
        Me.Init.Text = "&Initialize"
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.AddRange(New System.Windows.Forms.Control() {Me.SendData, Me.ReceiveData, Me.Receive, Me.Send})
        Me.Frame1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, 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(8, 46)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(397, 95)
        Me.Frame1.TabIndex = 1
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Send / Receive"
        '
        'SendData
        '
        Me.SendData.AcceptsReturn = True
        Me.SendData.AutoSize = False
        Me.SendData.BackColor = System.Drawing.SystemColors.Window
        Me.SendData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.SendData.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.SendData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.SendData.Location = New System.Drawing.Point(12, 24)
        Me.SendData.MaxLength = 0
        Me.SendData.Name = "SendData"
        Me.SendData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SendData.Size = New System.Drawing.Size(281, 24)
        Me.SendData.TabIndex = 5
        Me.SendData.Text = """ABCDEFGHIJK"" Test Data / 35 Bytes "
        '
        'ReceiveData
        '
        Me.ReceiveData.AcceptsReturn = True
        Me.ReceiveData.AutoSize = False
        Me.ReceiveData.BackColor = System.Drawing.SystemColors.Window
        Me.ReceiveData.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ReceiveData.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ReceiveData.ForeColor = System.Drawing.SystemColors.WindowText
        Me.ReceiveData.Location = New System.Drawing.Point(12, 60)
        Me.ReceiveData.MaxLength = 0
        Me.ReceiveData.Name = "ReceiveData"
        Me.ReceiveData.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ReceiveData.Size = New System.Drawing.Size(281, 24)
        Me.ReceiveData.TabIndex = 4
        Me.ReceiveData.Text = ""
        '
        'Receive
        '
        Me.Receive.BackColor = System.Drawing.SystemColors.Control
        Me.Receive.Cursor = System.Windows.Forms.Cursors.Default
        Me.Receive.Enabled = False
        Me.Receive.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Receive.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Receive.Location = New System.Drawing.Point(300, 60)
        Me.Receive.Name = "Receive"
        Me.Receive.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Receive.Size = New System.Drawing.Size(85, 23)
        Me.Receive.TabIndex = 3
        Me.Receive.Text = "&Receive"
        '
        'Send
        '
        Me.Send.BackColor = System.Drawing.SystemColors.Control
        Me.Send.Cursor = System.Windows.Forms.Cursors.Default
        Me.Send.Enabled = False
        Me.Send.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Send.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Send.Location = New System.Drawing.Point(300, 24)
        Me.Send.Name = "Send"
        Me.Send.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Send.Size = New System.Drawing.Size(85, 23)
        Me.Send.TabIndex = 2
        Me.Send.Text = "&Send"
        '
        'Frame2
        '
        Me.Frame2.BackColor = System.Drawing.SystemColors.Control
        Me.Frame2.Controls.AddRange(New System.Windows.Forms.Control() {Me.MyAddress, Me.Label5})
        Me.Frame2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame2.Location = New System.Drawing.Point(8, 0)
        Me.Frame2.Name = "Frame2"
        Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame2.Size = New System.Drawing.Size(185, 39)
        Me.Frame2.TabIndex = 0
        Me.Frame2.TabStop = False
        '
        'MyAddress
        '
        Me.MyAddress.AcceptsReturn = True
        Me.MyAddress.AutoSize = False
        Me.MyAddress.BackColor = System.Drawing.SystemColors.Window
        Me.MyAddress.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.MyAddress.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MyAddress.ForeColor = System.Drawing.SystemColors.WindowText
        Me.MyAddress.Location = New System.Drawing.Point(124, 12)
        Me.MyAddress.MaxLength = 0
        Me.MyAddress.Multiline = True
        Me.MyAddress.Name = "MyAddress"
        Me.MyAddress.ReadOnly = True
        Me.MyAddress.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.MyAddress.Size = New System.Drawing.Size(25, 24)
        Me.MyAddress.TabIndex = 14
        Me.MyAddress.TabStop = False
        Me.MyAddress.Text = ""
        Me.MyAddress.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label5
        '
        Me.Label5.BackColor = System.Drawing.SystemColors.Control
        Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label5.Location = New System.Drawing.Point(26, 16)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(93, 19)
        Me.Label5.TabIndex = 15
        Me.Label5.Text = "My Address ="
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(416, 48)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(105, 17)
        Me.Label1.TabIndex = 20
        Me.Label1.Text = "Delimiter"
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.SystemColors.Control
        Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(9, 155)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(97, 15)
        Me.Label3.TabIndex = 13
        Me.Label3.Text = "Return value"
        '
        'Form1
        '
        Me.ClientSize = New System.Drawing.Size(528, 210)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.DelimBox, Me.Frame3, Me.Ret_Del, Me.Text_Del, Me.TextRet, Me.Polling, Me.GetCmd, Me.Exit_Renamed, Me.Init, Me.Frame1, Me.Frame2, Me.Label1, Me.Label3})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Location = New System.Drawing.Point(190, 142)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "Master Mode"
        Me.Frame3.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        Me.Frame2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As Form1
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As Form1
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New Form1()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
    Dim SendBuf As String                       'A sending buffer
    Dim RecvBuf As New String("", 10000)        'A receiving buffer
    Dim Pstb(15) As Integer                     'Array of Status Byte
    Dim ErrText As String                       'For string text
    Dim Srlen As Integer                        'A length of a character string
    Dim Delim As Integer                        'Delimiter
    Dim gChCmd As GCHandle                      'GCHandle for cmd array
    Dim gChPstb As GCHandle                     'GCHandle for Pstb array
    Dim pPstb As IntPtr                         'IntPtr for Pstb array
    Dim pFstb As IntPtr                         'IntPtr for Fstb array

    Private Sub DelimBox_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles DelimBox.SelectedIndexChanged

        Eoi = 1

        Delim = DelimBox.SelectedIndex
        Ret = GpDelim(Delim, Eoi)

    End Sub

    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load '[ Form load ]

        YradrBox.Text = CStr(1)                 'An initial value of remote machine vessel address is set up
        DelimBox.Text = "CR+LF"

        'Specify Pinned handle to Cmd
        If gChCmd.IsAllocated = False Then
            gChCmd = GCHandle.Alloc(Cmd, GCHandleType.Pinned)
        End If
        'Specify Pinned handle to Pstb
        If gChPstb.IsAllocated = False Then
            gChPstb = GCHandle.Alloc(Pstb, GCHandleType.Pinned)
        End If
        'Get address object by Pinned handle
        pCmd = gChCmd.AddrOfPinnedObject()
        pPstb = gChPstb.AddrOfPinnedObject()

    End Sub

    Private Sub Init_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Init.Click '[ Initialize ]

        Ret = GpibInit(ErrText)                 'In SubClass.bas file
        If Ret = 1 Then GoTo Err_Renamed

        YrAddr = CInt(YradrBox.Text)

        Send.Enabled = True
        Receive.Enabled = True
        GetCmd.Enabled = True
        Polling.Enabled = True

        Ret = GpBoardsts(&HAS, Mode)
        If Mode = 1 Then
            ErrText = "An equipment of a master is not found out."
            GoTo Err_Renamed
        End If
        MyAddress.Text = CStr(MyAddr)

        If YradrBox.Items.Count = 31 Then       'MyAddress is deleted from a list.
            YradrBox.Items.RemoveAt((MyAddr))
            If MyAddr = YrAddr Then
                YradrBox.SelectedIndex = 0
            End If
        End If

        Call DelimBox_SelectedIndexChanged(DelimBox, New System.EventArgs())

Err_Renamed:
        TextRet.Text = ErrText

    End Sub

    Private Sub GetCmd_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GetCmd.Click '[ GET ]

        Ret = GpGet(YrAddr)                     'They carry out a command ti a remote machine vessel.
        If CheckRet("GpGet", Ret, ErrText) = 1 Then GoTo Err_Renamed
Err_Renamed:
        TextRet.Text = ErrText

    End Sub

    Private Sub Polling_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Polling.Click '[ Polling ]

        Send.Enabled = False
        Receive.Enabled = False
        Init.Enabled = False
        GetCmd.Enabled = False
        Polling.Enabled = False
        Init.Enabled = False


        TextRet.Text = "Polling..."
        TextRet.Refresh()                   'Refresh

        For Cnt = 0 To 1                    'Polling count + 1
            Pstb(Cnt) = 0
        Next

        Cmd(0) = 1                          'Number of command
        Cmd(1) = YrAddr                     'It is polling to which equipment or they acquire
        Ret = GpPoll(pCmd, pPstb)           'They carry out a serial poll.

        If ((Ret And &HFFS) = 0) Or ((Ret And &HFFS) = 1) Then      'If SRQ was found out,0 or 1 returns
            ErrText = "SRQ was confirmation.Taker =[" & Cmd(Pstb(0)) & "] : StatusByte =[" & Hex(Pstb(Pstb(0))) & "]H"
        ElseIf (Ret = 128) Then             'When it is not found,128 returns.
            ErrText = "[SRQ] was not found out."
        Else
            If CheckRet("GpPoll", Ret, ErrText) = 1 Then GoTo Err_Renamed
        End If
Err_Renamed:
        TextRet.Text = ErrText
        Send.Enabled = True
        Receive.Enabled = True
        Init.Enabled = True
        GetCmd.Enabled = True
        Polling.Enabled = True

    End Sub

    Private Sub Send_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Send.Click '[ Send ]

        Send.Enabled = False
        Receive.Enabled = False
        Init.Enabled = False
        GetCmd.Enabled = False
        Polling.Enabled = False

        TextRet.Text = "They are waiting that a slave receiving."
        TextRet.Refresh()                   'Refresh

        SendBuf = SendData.Text             'Transmit data is input in a buffer.
        Srlen = Len(SendBuf)                'A length of a buffer is acquired.
        Cmd(0) = 2                          'Number of command.
        Cmd(1) = MyAddr                     'Talker address is decided.
        Cmd(2) = YrAddr                     'Listen address is decided.

        If Srlen = 0 Then                   'Transmit data is processing of time of 0.
            TextRet.Text = "There is not transmit data."
            Exit Sub                        'It comes out from subroutine.
        End If

        Ret = GpTalk(pCmd, Srlen, SendBuf)  'Carry out sending.
        If CheckRet("GpTalk", Ret, ErrText) = 1 Then GoTo Err_Renamed
Err_Renamed:
        TextRet.Text = ErrText
        Send.Enabled = True
        Receive.Enabled = True
        Init.Enabled = True
        GetCmd.Enabled = True
        Polling.Enabled = True

    End Sub

    Private Sub Receive_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Receive.Click '[Receiving ]

        Send.Enabled = False
        Receive.Enabled = False
        Init.Enabled = False
        GetCmd.Enabled = False
        Polling.Enabled = False

        TextRet.Text = "It is receiving from a slave."
        TextRet.Refresh()                   'Refresh

        Srlen = Len(RecvBuf)                'A maximum value of receive data is designated.
        Cmd(0) = 2                          'Number of command.
        Cmd(1) = YrAddr                     'Listener address is recquired.
        Cmd(2) = MyAddr                     'Taker address is recquired.

        Ret = GpListen(pCmd, Srlen, RecvBuf)            'ACSII data is received.
        If CheckRet("GpListen", Ret, ErrText) = 1 Then GoTo Err_Renamed
        ReceiveData.Text = VB.Left(RecvBuf, Srlen)      'A receiving character string is displayed.
Err_Renamed:
        TextRet.Text = ErrText
        Send.Enabled = True
        Receive.Enabled = True
        Init.Enabled = True
        GetCmd.Enabled = True
        Polling.Enabled = True

    End Sub

    Private Sub Ret_Del_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Ret_Del.Click '[ An erase of a returning value ]

        TextRet.Text = ""

    End Sub

    Private Sub Text_Del_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Text_Del.Click '[ An erase of transmit data ]

        ReceiveData.Text = ""
        SendData.Text = ""

    End Sub

    Private Sub YradrBox_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles YradrBox.SelectedIndexChanged '[ Change of remote machine vessel address ]

        YrAddr = CInt(YradrBox.Text)

    End Sub

    Private Sub Exit_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Exit_Renamed.Click '[ End ]

        Ret = GpibExit()
        Me.Close()

    End Sub

    Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed

        'GCHandle free
        If gChCmd.IsAllocated = True Then
            gChCmd.Free()
        End If
        If gChPstb.IsAllocated = True Then
            gChPstb.Free()
        End If
    End Sub
End Class