Option Strict Off
Option Explicit On 
Imports System.Runtime.InteropServices
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 TextRet As System.Windows.Forms.TextBox
	Public WithEvents Frame5 As System.Windows.Forms.GroupBox
	Public WithEvents Send As System.Windows.Forms.Button
	Public WithEvents DelOne As System.Windows.Forms.Button
	Public WithEvents DelAll As System.Windows.Forms.Button
	Public WithEvents CmdList As System.Windows.Forms.TextBox
	Public WithEvents Frame4 As System.Windows.Forms.GroupBox
	Public WithEvents Exit_Renamed As System.Windows.Forms.Button
	Public WithEvents Initialize As System.Windows.Forms.Button
	Public WithEvents UNL As System.Windows.Forms.Button
	Public WithEvents DCL As System.Windows.Forms.Button
	Public WithEvents LLO As System.Windows.Forms.Button
	Public WithEvents UNT As System.Windows.Forms.Button
	Public WithEvents Frame3 As System.Windows.Forms.GroupBox
	Public WithEvents GET_Renamed As System.Windows.Forms.Button
	Public WithEvents SDC As System.Windows.Forms.Button
	Public WithEvents GTL As System.Windows.Forms.Button
	Public WithEvents YrAdrBox As System.Windows.Forms.ComboBox
	Public WithEvents Label1 As System.Windows.Forms.Label
	Public WithEvents Frame2 As System.Windows.Forms.GroupBox
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	'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.Frame5 = New System.Windows.Forms.GroupBox()
        Me.TextRet = New System.Windows.Forms.TextBox()
        Me.Frame4 = New System.Windows.Forms.GroupBox()
        Me.Send = New System.Windows.Forms.Button()
        Me.DelOne = New System.Windows.Forms.Button()
        Me.DelAll = New System.Windows.Forms.Button()
        Me.CmdList = New System.Windows.Forms.TextBox()
        Me.Exit_Renamed = New System.Windows.Forms.Button()
        Me.Initialize = New System.Windows.Forms.Button()
        Me.Frame1 = New System.Windows.Forms.GroupBox()
        Me.Frame3 = New System.Windows.Forms.GroupBox()
        Me.UNL = New System.Windows.Forms.Button()
        Me.DCL = New System.Windows.Forms.Button()
        Me.LLO = New System.Windows.Forms.Button()
        Me.UNT = New System.Windows.Forms.Button()
        Me.Frame2 = New System.Windows.Forms.GroupBox()
        Me.GET_Renamed = New System.Windows.Forms.Button()
        Me.SDC = New System.Windows.Forms.Button()
        Me.GTL = New System.Windows.Forms.Button()
        Me.YrAdrBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Frame5.SuspendLayout()
        Me.Frame4.SuspendLayout()
        Me.Frame1.SuspendLayout()
        Me.Frame3.SuspendLayout()
        Me.Frame2.SuspendLayout()
        Me.SuspendLayout()
        '
        'Frame5
        '
        Me.Frame5.BackColor = System.Drawing.SystemColors.Control
        Me.Frame5.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextRet})
        Me.Frame5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame5.Location = New System.Drawing.Point(6, 224)
        Me.Frame5.Name = "Frame5"
        Me.Frame5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame5.Size = New System.Drawing.Size(495, 55)
        Me.Frame5.TabIndex = 20
        Me.Frame5.TabStop = False
        Me.Frame5.Text = "Return value"
        '
        '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.ForeColor = System.Drawing.SystemColors.WindowText
        Me.TextRet.Location = New System.Drawing.Point(10, 20)
        Me.TextRet.MaxLength = 0
        Me.TextRet.Name = "TextRet"
        Me.TextRet.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.TextRet.Size = New System.Drawing.Size(473, 24)
        Me.TextRet.TabIndex = 14
        Me.TextRet.Text = ""
        '
        'Frame4
        '
        Me.Frame4.BackColor = System.Drawing.SystemColors.Control
        Me.Frame4.Controls.AddRange(New System.Windows.Forms.Control() {Me.Send, Me.DelOne, Me.DelAll, Me.CmdList})
        Me.Frame4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame4.Location = New System.Drawing.Point(8, 112)
        Me.Frame4.Name = "Frame4"
        Me.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame4.Size = New System.Drawing.Size(495, 109)
        Me.Frame4.TabIndex = 19
        Me.Frame4.TabStop = False
        Me.Frame4.Text = "Output message (MAX=30)"
        '
        'Send
        '
        Me.Send.BackColor = System.Drawing.SystemColors.Control
        Me.Send.Cursor = System.Windows.Forms.Cursors.Default
        Me.Send.Enabled = False
        Me.Send.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Send.Location = New System.Drawing.Point(426, 22)
        Me.Send.Name = "Send"
        Me.Send.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Send.Size = New System.Drawing.Size(63, 73)
        Me.Send.TabIndex = 13
        Me.Send.Text = "&Send"
        '
        'DelOne
        '
        Me.DelOne.BackColor = System.Drawing.SystemColors.Control
        Me.DelOne.Cursor = System.Windows.Forms.Cursors.Default
        Me.DelOne.ForeColor = System.Drawing.SystemColors.ControlText
        Me.DelOne.Location = New System.Drawing.Point(344, 60)
        Me.DelOne.Name = "DelOne"
        Me.DelOne.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.DelOne.Size = New System.Drawing.Size(79, 35)
        Me.DelOne.TabIndex = 12
        Me.DelOne.Text = "&One Del"
        '
        'DelAll
        '
        Me.DelAll.BackColor = System.Drawing.SystemColors.Control
        Me.DelAll.Cursor = System.Windows.Forms.Cursors.Default
        Me.DelAll.ForeColor = System.Drawing.SystemColors.ControlText
        Me.DelAll.Location = New System.Drawing.Point(344, 22)
        Me.DelAll.Name = "DelAll"
        Me.DelAll.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.DelAll.Size = New System.Drawing.Size(79, 35)
        Me.DelAll.TabIndex = 11
        Me.DelAll.Text = "&All Del"
        '
        'CmdList
        '
        Me.CmdList.AcceptsReturn = True
        Me.CmdList.AutoSize = False
        Me.CmdList.BackColor = System.Drawing.SystemColors.Window
        Me.CmdList.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.CmdList.ForeColor = System.Drawing.SystemColors.WindowText
        Me.CmdList.Location = New System.Drawing.Point(10, 22)
        Me.CmdList.MaxLength = 0
        Me.CmdList.Multiline = True
        Me.CmdList.Name = "CmdList"
        Me.CmdList.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.CmdList.Size = New System.Drawing.Size(331, 73)
        Me.CmdList.TabIndex = 10
        Me.CmdList.Text = ""
        '
        'Exit_Renamed
        '
        Me.Exit_Renamed.BackColor = System.Drawing.SystemColors.Control
        Me.Exit_Renamed.Cursor = System.Windows.Forms.Cursors.Default
        Me.Exit_Renamed.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Exit_Renamed.Location = New System.Drawing.Point(416, 64)
        Me.Exit_Renamed.Name = "Exit_Renamed"
        Me.Exit_Renamed.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Exit_Renamed.Size = New System.Drawing.Size(87, 29)
        Me.Exit_Renamed.TabIndex = 1
        Me.Exit_Renamed.Text = "E&xit"
        '
        'Initialize
        '
        Me.Initialize.BackColor = System.Drawing.SystemColors.Control
        Me.Initialize.Cursor = System.Windows.Forms.Cursors.Default
        Me.Initialize.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Initialize.Location = New System.Drawing.Point(416, 18)
        Me.Initialize.Name = "Initialize"
        Me.Initialize.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Initialize.Size = New System.Drawing.Size(87, 31)
        Me.Initialize.TabIndex = 0
        Me.Initialize.Text = "&Initialize"
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.SystemColors.Control
        Me.Frame1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Frame3, Me.Frame2})
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(8, 2)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(391, 107)
        Me.Frame1.TabIndex = 15
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Command Editor"
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.SystemColors.Control
        Me.Frame3.Controls.AddRange(New System.Windows.Forms.Control() {Me.UNL, Me.DCL, Me.LLO, Me.UNT})
        Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame3.Location = New System.Drawing.Point(222, 18)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(155, 79)
        Me.Frame3.TabIndex = 17
        Me.Frame3.TabStop = False
        Me.Frame3.Text = "Only Command"
        '
        'UNL
        '
        Me.UNL.BackColor = System.Drawing.SystemColors.Control
        Me.UNL.Cursor = System.Windows.Forms.Cursors.Default
        Me.UNL.ForeColor = System.Drawing.SystemColors.ControlText
        Me.UNL.Location = New System.Drawing.Point(82, 50)
        Me.UNL.Name = "UNL"
        Me.UNL.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.UNL.Size = New System.Drawing.Size(63, 23)
        Me.UNL.TabIndex = 9
        Me.UNL.Text = "U&NL"
        '
        'DCL
        '
        Me.DCL.BackColor = System.Drawing.SystemColors.Control
        Me.DCL.Cursor = System.Windows.Forms.Cursors.Default
        Me.DCL.ForeColor = System.Drawing.SystemColors.ControlText
        Me.DCL.Location = New System.Drawing.Point(82, 20)
        Me.DCL.Name = "DCL"
        Me.DCL.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.DCL.Size = New System.Drawing.Size(63, 23)
        Me.DCL.TabIndex = 7
        Me.DCL.Text = "&DCL"
        '
        'LLO
        '
        Me.LLO.BackColor = System.Drawing.SystemColors.Control
        Me.LLO.Cursor = System.Windows.Forms.Cursors.Default
        Me.LLO.ForeColor = System.Drawing.SystemColors.ControlText
        Me.LLO.Location = New System.Drawing.Point(10, 20)
        Me.LLO.Name = "LLO"
        Me.LLO.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.LLO.Size = New System.Drawing.Size(63, 23)
        Me.LLO.TabIndex = 6
        Me.LLO.Text = "&LLO"
        '
        'UNT
        '
        Me.UNT.BackColor = System.Drawing.SystemColors.Control
        Me.UNT.Cursor = System.Windows.Forms.Cursors.Default
        Me.UNT.ForeColor = System.Drawing.SystemColors.ControlText
        Me.UNT.Location = New System.Drawing.Point(10, 50)
        Me.UNT.Name = "UNT"
        Me.UNT.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.UNT.Size = New System.Drawing.Size(63, 23)
        Me.UNT.TabIndex = 8
        Me.UNT.Text = "&UNT"
        '
        'Frame2
        '
        Me.Frame2.BackColor = System.Drawing.SystemColors.Control
        Me.Frame2.Controls.AddRange(New System.Windows.Forms.Control() {Me.GET_Renamed, Me.SDC, Me.GTL, Me.YrAdrBox, Me.Label1})
        Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame2.Location = New System.Drawing.Point(12, 18)
        Me.Frame2.Name = "Frame2"
        Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame2.Size = New System.Drawing.Size(213, 79)
        Me.Frame2.TabIndex = 16
        Me.Frame2.TabStop = False
        Me.Frame2.Text = "With Address"
        '
        'GET_Renamed
        '
        Me.GET_Renamed.BackColor = System.Drawing.SystemColors.Control
        Me.GET_Renamed.Cursor = System.Windows.Forms.Cursors.Default
        Me.GET_Renamed.ForeColor = System.Drawing.SystemColors.ControlText
        Me.GET_Renamed.Location = New System.Drawing.Point(142, 50)
        Me.GET_Renamed.Name = "GET_Renamed"
        Me.GET_Renamed.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.GET_Renamed.Size = New System.Drawing.Size(63, 23)
        Me.GET_Renamed.TabIndex = 5
        Me.GET_Renamed.Text = "GE&T"
        '
        'SDC
        '
        Me.SDC.BackColor = System.Drawing.SystemColors.Control
        Me.SDC.Cursor = System.Windows.Forms.Cursors.Default
        Me.SDC.ForeColor = System.Drawing.SystemColors.ControlText
        Me.SDC.Location = New System.Drawing.Point(74, 50)
        Me.SDC.Name = "SDC"
        Me.SDC.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SDC.Size = New System.Drawing.Size(63, 23)
        Me.SDC.TabIndex = 4
        Me.SDC.Text = "S&DC"
        '
        'GTL
        '
        Me.GTL.BackColor = System.Drawing.SystemColors.Control
        Me.GTL.Cursor = System.Windows.Forms.Cursors.Default
        Me.GTL.ForeColor = System.Drawing.SystemColors.ControlText
        Me.GTL.Location = New System.Drawing.Point(6, 50)
        Me.GTL.Name = "GTL"
        Me.GTL.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.GTL.Size = New System.Drawing.Size(63, 23)
        Me.GTL.TabIndex = 3
        Me.GTL.Text = "&GTL"
        '
        '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.ForeColor = System.Drawing.SystemColors.WindowText
        Me.YrAdrBox.Location = New System.Drawing.Point(152, 20)
        Me.YrAdrBox.Name = "YrAdrBox"
        Me.YrAdrBox.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.YrAdrBox.Size = New System.Drawing.Size(51, 21)
        Me.YrAdrBox.TabIndex = 2
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(10, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(133, 15)
        Me.Label1.TabIndex = 18
        Me.Label1.Text = "Address of device ="
        '
        'Form1
        '
        Me.ClientSize = New System.Drawing.Size(512, 290)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Frame5, Me.Frame4, Me.Exit_Renamed, Me.Initialize, Me.Frame1})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Location = New System.Drawing.Point(63, 107)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "MultiLine Message"
        Me.Frame5.ResumeLayout(False)
        Me.Frame4.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        Me.Frame3.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 
	'******************************************************* [Constant] ***
    Const GP_GTL As Short = &H1S           'GTL / Go To Local
    Const GP_SDC As Short = &H4S           'SDC / Selected Device Clear
    Const GP_PPC As Short = &H5S           'PPC / Parallel Poll Configure
    Const GP_GET As Short = &H8S           'GET / Group Excute Trigger
    Const GP_TCT As Short = &H9S           'TCT / Take ConTrol
    Const GP_LLO As Short = &H11S          'LLO / Local Lock Out
    Const GP_DCL As Short = &H14S          'DCL / Device CLear
    Const GP_PPU As Short = &H15S          'PPU / Parallel Poll Unconfigure
    Const GP_SPE As Short = &H18S          'SPE / Serial Poll Enable
    Const GP_SPD As Short = &H19S          'SPD / Serial Poll Disable
    Const GP_MLA As Short = &H20S          'MLA / My Listener Address
    Const GP_UNL As Short = &H3FS          'UNL / UnListen
    Const GP_MTA As Short = &H40S          'MTA / My Talker Address
    Const GP_UNT As Short = &H5FS          'UNT / UnTalker
	
    Dim bRet As Short                       'It is used AddComand function
    Dim CmdNumArray(50) As Integer          'Array of command
    Dim CmdNumPos As Integer                'A place of a command array
    Dim Adrs As Integer                     'It is used at the time of address making
    Dim ErrText As String                   'For a text
    Dim gChCmd As GCHandle                  'GCHandle for cmd array

	Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load '[ Form load ]
		
        For Adrs = 0 To 30                  'Making address of device
            YrAdrBox.Items.Add(CStr(Adrs))
        Next Adrs

        YrAdrBox.Text = CStr(1)             'Initial setting(First of all in address of device)
        CmdNum = 1                          'Initial setting(First of all in number of command)

        'Specify Pinned handle to Cmd
        If gChCmd.IsAllocated = False Then
            gChCmd = GCHandle.Alloc(Cmd, GCHandleType.Pinned)
        End If
        'Get address object by Pinned handle
        pCmd = gChCmd.AddrOfPinnedObject()
		
	End Sub
	
	Private Sub Initialize_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Initialize.Click '[ Initialize ]
		
        Ret = GpibInit(ErrText)             'SubClass.bas
		If Ret = 1 Then GoTo Err_Renamed
		
        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

        Send.Enabled = True

        Ret = GpBoardsts(&H8S, MyAddr)
Err_Renamed:
        TextRet.Text = ErrText
		
	End Sub
	
	Private Sub Send_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Send.Click '[ Sending ]
		
        Cmd(0) = CmdNum - 1                     'Number of command
		
        If (CmdNum <= 1) Then                   'If there was not a command
            ErrText = "Please input a command."
        Else
            Ret = GpComand(pCmd)                'Command (character string) sending
            If CheckRet("GpComand", Ret, ErrText) = 1 Then GoTo Err_Renamed
        End If

Err_Renamed:
        TextRet.Text = ErrText
		
	End Sub
	
	Private Sub DCL_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles DCL.Click '[ DCL ]
        bRet = AddCommand(GP_DCL, 1)            'AddComand(A constant, Number)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 1
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
        CmdList.Text = DispCommandList()        'SubClass.bas
		
	End Sub
	
	Private Sub GET_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GET_Renamed.Click '[ GET ]
		
		bRet = AddCommand(GP_GET, 2)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 2
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
	Private Sub GTL_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GTL.Click '[ GTL ]
		
		bRet = AddCommand(GP_GTL, 2)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 2
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
	Private Sub LLO_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles LLO.Click '[ LLO ]
		
		bRet = AddCommand(GP_LLO, 1)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 1
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
	Private Sub SDC_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles SDC.Click '[ SDC ]
		
		bRet = AddCommand(GP_SDC, 2)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 2
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
	Private Sub UNL_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UNL.Click '[ UNL ]
		
		bRet = AddCommand(GP_UNL, 1)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 1
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
	Private Sub UNT_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UNT.Click '[ UNT ]
		
		bRet = AddCommand(GP_UNT, 1)
		If bRet = True Then
			CmdNumArray(CmdNumPos) = 1
			CmdNumPos = CmdNumPos + 1
			TextRet.Text = ""
		End If
		CmdList.Text = DispCommandList()
		
	End Sub
	
    Private Sub YrAdrBox_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles YrAdrBox.SelectedIndexChanged '[ When remote machine vessel address was modified ]

        YrAddr = CInt(YrAdrBox.Text)

    End Sub

    Private Sub DelAll_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles DelAll.Click '[ At a command all an erase ]

        CmdNum = 1
        CmdNumPos = 0

        CmdList.Text = ""

    End Sub

    Private Sub DelOne_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles DelOne.Click '[ 1 command erase ]

        If CmdNumPos = 0 Then                   'When there is not message
            TextRet.Text = "There is not multi line message."
        Else
            If CmdNumArray(CmdNumPos - 1) = 1 Then
                Cmd(CmdNum) = 0
                CmdNum = CmdNum - 1
            Else
                Cmd(CmdNum) = 0
                Cmd(CmdNum - 1) = 0
                CmdNum = CmdNum - 2
            End If
            CmdNumArray(CmdNumPos - 1) = 0
            CmdNumPos = CmdNumPos - 1
            TextRet.Text = ""
        End If
        CmdList.Text = DispCommandList()

    End Sub

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

        Ret = GpibExit()                        'SubClass.bas
        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
    End Sub
End Class