using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using CgpibCs;

namespace Master
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form_master : System.Windows.Forms.Form
	{
		public System.Windows.Forms.GroupBox Frame6;
		public System.Windows.Forms.Button cmdPPoll;
		public System.Windows.Forms.Button cmdSetPPoll;
		public System.Windows.Forms.Button cmdSPoll;
		public System.Windows.Forms.Button cmdExit;
		public System.Windows.Forms.Button cmdRetDel;
		public System.Windows.Forms.Button cmdDataDel;
		public System.Windows.Forms.GroupBox Frame4;
		public System.Windows.Forms.ListBox lstRet;
		public System.Windows.Forms.GroupBox Frame2;
		public System.Windows.Forms.TextBox txtMyAddr;
		public System.Windows.Forms.TextBox txtDevName;
		public System.Windows.Forms.Label Label5;
		public System.Windows.Forms.Label Label1;
		public System.Windows.Forms.GroupBox Frame3;
		public System.Windows.Forms.TextBox txtAddr;
		public System.Windows.Forms.Button cmdSearch;
		public System.Windows.Forms.ComboBox cboEoi;
		public System.Windows.Forms.ComboBox cboDelim;
		public System.Windows.Forms.ComboBox cboAddr;
		public System.Windows.Forms.Label Label4;
		public System.Windows.Forms.Label Label3;
		public System.Windows.Forms.Label Label2;
		public System.Windows.Forms.GroupBox Frame1;
		public System.Windows.Forms.Button cmdRec;
		public System.Windows.Forms.TextBox txtRec;
		public System.Windows.Forms.Button cmdSend;
		public System.Windows.Forms.TextBox txtSend;
		public System.Windows.Forms.GroupBox Frame5;
		public System.Windows.Forms.Button cmdLlo;
		public System.Windows.Forms.Button cmdGtl;
		public System.Windows.Forms.Button cmdDcl;
		public System.Windows.Forms.Button cmdSdc;
		public System.Windows.Forms.Button cmdGet;
		public System.Windows.Forms.Label Line1;
		public System.Windows.Forms.Button cmdInit;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		Cgpib  gpib = new Cgpib();

		short	m_Id;
		short[]	m_EqpId = new short[32];
		short	m_SelectEqpId;

		public Form_master()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Frame6 = new System.Windows.Forms.GroupBox();
			this.cmdPPoll = new System.Windows.Forms.Button();
			this.cmdSetPPoll = new System.Windows.Forms.Button();
			this.cmdSPoll = new System.Windows.Forms.Button();
			this.cmdExit = new System.Windows.Forms.Button();
			this.cmdRetDel = new System.Windows.Forms.Button();
			this.cmdDataDel = new System.Windows.Forms.Button();
			this.Frame4 = new System.Windows.Forms.GroupBox();
			this.lstRet = new System.Windows.Forms.ListBox();
			this.Frame2 = new System.Windows.Forms.GroupBox();
			this.txtMyAddr = new System.Windows.Forms.TextBox();
			this.txtDevName = new System.Windows.Forms.TextBox();
			this.Label5 = new System.Windows.Forms.Label();
			this.Label1 = new System.Windows.Forms.Label();
			this.Frame3 = new System.Windows.Forms.GroupBox();
			this.txtAddr = new System.Windows.Forms.TextBox();
			this.cmdSearch = new System.Windows.Forms.Button();
			this.cboEoi = new System.Windows.Forms.ComboBox();
			this.cboDelim = new System.Windows.Forms.ComboBox();
			this.cboAddr = new System.Windows.Forms.ComboBox();
			this.Label4 = new System.Windows.Forms.Label();
			this.Label3 = new System.Windows.Forms.Label();
			this.Label2 = new System.Windows.Forms.Label();
			this.Frame1 = new System.Windows.Forms.GroupBox();
			this.cmdRec = new System.Windows.Forms.Button();
			this.txtRec = new System.Windows.Forms.TextBox();
			this.cmdSend = new System.Windows.Forms.Button();
			this.txtSend = new System.Windows.Forms.TextBox();
			this.Frame5 = new System.Windows.Forms.GroupBox();
			this.cmdLlo = new System.Windows.Forms.Button();
			this.cmdGtl = new System.Windows.Forms.Button();
			this.cmdDcl = new System.Windows.Forms.Button();
			this.cmdSdc = new System.Windows.Forms.Button();
			this.cmdGet = new System.Windows.Forms.Button();
			this.Line1 = new System.Windows.Forms.Label();
			this.cmdInit = new System.Windows.Forms.Button();
			this.Frame6.SuspendLayout();
			this.Frame4.SuspendLayout();
			this.Frame2.SuspendLayout();
			this.Frame3.SuspendLayout();
			this.Frame1.SuspendLayout();
			this.Frame5.SuspendLayout();
			this.SuspendLayout();
			// 
			// Frame6
			// 
			this.Frame6.BackColor = System.Drawing.SystemColors.Control;
			this.Frame6.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.cmdPPoll,
																				 this.cmdSetPPoll,
																				 this.cmdSPoll});
			this.Frame6.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame6.Location = new System.Drawing.Point(576, 232);
			this.Frame6.Name = "Frame6";
			this.Frame6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame6.Size = new System.Drawing.Size(129, 140);
			this.Frame6.TabIndex = 65;
			this.Frame6.TabStop = false;
			this.Frame6.Text = "Polling";
			// 
			// cmdPPoll
			// 
			this.cmdPPoll.BackColor = System.Drawing.SystemColors.Control;
			this.cmdPPoll.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdPPoll.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdPPoll.Location = new System.Drawing.Point(8, 102);
			this.cmdPPoll.Name = "cmdPPoll";
			this.cmdPPoll.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdPPoll.Size = new System.Drawing.Size(113, 29);
			this.cmdPPoll.TabIndex = 21;
			this.cmdPPoll.Text = "Exe Parallel poll";
			this.cmdPPoll.Click += new System.EventHandler(this.cmdPPoll_Click);
			// 
			// cmdSetPPoll
			// 
			this.cmdSetPPoll.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSetPPoll.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSetPPoll.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSetPPoll.Location = new System.Drawing.Point(8, 65);
			this.cmdSetPPoll.Name = "cmdSetPPoll";
			this.cmdSetPPoll.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSetPPoll.Size = new System.Drawing.Size(113, 29);
			this.cmdSetPPoll.TabIndex = 20;
			this.cmdSetPPoll.Text = "Set parallel poll";
			this.cmdSetPPoll.Click += new System.EventHandler(this.cmdSetPPoll_Click);
			// 
			// cmdSPoll
			// 
			this.cmdSPoll.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSPoll.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSPoll.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSPoll.Location = new System.Drawing.Point(8, 19);
			this.cmdSPoll.Name = "cmdSPoll";
			this.cmdSPoll.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSPoll.Size = new System.Drawing.Size(113, 29);
			this.cmdSPoll.TabIndex = 19;
			this.cmdSPoll.Text = "Serial poll(&P)";
			this.cmdSPoll.Click += new System.EventHandler(this.cmdSPoll_Click);
			// 
			// cmdExit
			// 
			this.cmdExit.BackColor = System.Drawing.SystemColors.Control;
			this.cmdExit.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdExit.Location = new System.Drawing.Point(416, 48);
			this.cmdExit.Name = "cmdExit";
			this.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdExit.Size = new System.Drawing.Size(113, 29);
			this.cmdExit.TabIndex = 66;
			this.cmdExit.Text = "Exit(&X)";
			this.cmdExit.Click += new System.EventHandler(this.cmdExit_Click);
			// 
			// cmdRetDel
			// 
			this.cmdRetDel.BackColor = System.Drawing.SystemColors.Control;
			this.cmdRetDel.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdRetDel.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdRetDel.Location = new System.Drawing.Point(144, 392);
			this.cmdRetDel.Name = "cmdRetDel";
			this.cmdRetDel.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdRetDel.Size = new System.Drawing.Size(113, 29);
			this.cmdRetDel.TabIndex = 63;
			this.cmdRetDel.Text = "Clear Return Code";
			this.cmdRetDel.Click += new System.EventHandler(this.cmdRetDel_Click);
			// 
			// cmdDataDel
			// 
			this.cmdDataDel.BackColor = System.Drawing.SystemColors.Control;
			this.cmdDataDel.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdDataDel.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdDataDel.Location = new System.Drawing.Point(24, 392);
			this.cmdDataDel.Name = "cmdDataDel";
			this.cmdDataDel.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdDataDel.Size = new System.Drawing.Size(113, 29);
			this.cmdDataDel.TabIndex = 62;
			this.cmdDataDel.Text = "Clear Data";
			this.cmdDataDel.Click += new System.EventHandler(this.cmdDataDel_Click);
			// 
			// Frame4
			// 
			this.Frame4.BackColor = System.Drawing.SystemColors.Control;
			this.Frame4.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.lstRet});
			this.Frame4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame4.Location = new System.Drawing.Point(8, 288);
			this.Frame4.Name = "Frame4";
			this.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame4.Size = new System.Drawing.Size(545, 94);
			this.Frame4.TabIndex = 61;
			this.Frame4.TabStop = false;
			this.Frame4.Text = "Return Code";
			// 
			// lstRet
			// 
			this.lstRet.BackColor = System.Drawing.SystemColors.Window;
			this.lstRet.Cursor = System.Windows.Forms.Cursors.Default;
			this.lstRet.ForeColor = System.Drawing.SystemColors.WindowText;
			this.lstRet.Location = new System.Drawing.Point(8, 19);
			this.lstRet.Name = "lstRet";
			this.lstRet.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.lstRet.Size = new System.Drawing.Size(529, 43);
			this.lstRet.TabIndex = 33;
			// 
			// Frame2
			// 
			this.Frame2.BackColor = System.Drawing.SystemColors.Control;
			this.Frame2.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.txtMyAddr,
																				 this.txtDevName,
																				 this.Label5,
																				 this.Label1});
			this.Frame2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame2.Location = new System.Drawing.Point(8, 16);
			this.Frame2.Name = "Frame2";
			this.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame2.Size = new System.Drawing.Size(376, 57);
			this.Frame2.TabIndex = 59;
			this.Frame2.TabStop = false;
			this.Frame2.Text = "Self information";
			// 
			// txtMyAddr
			// 
			this.txtMyAddr.AcceptsReturn = true;
			this.txtMyAddr.AutoSize = false;
			this.txtMyAddr.BackColor = System.Drawing.SystemColors.Window;
			this.txtMyAddr.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtMyAddr.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtMyAddr.Location = new System.Drawing.Point(304, 18);
			this.txtMyAddr.MaxLength = 0;
			this.txtMyAddr.Name = "txtMyAddr";
			this.txtMyAddr.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtMyAddr.Size = new System.Drawing.Size(33, 25);
			this.txtMyAddr.TabIndex = 32;
			this.txtMyAddr.Text = "";
			// 
			// txtDevName
			// 
			this.txtDevName.AcceptsReturn = true;
			this.txtDevName.AutoSize = false;
			this.txtDevName.BackColor = System.Drawing.SystemColors.Window;
			this.txtDevName.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtDevName.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtDevName.Location = new System.Drawing.Point(96, 18);
			this.txtDevName.MaxLength = 0;
			this.txtDevName.Name = "txtDevName";
			this.txtDevName.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtDevName.Size = new System.Drawing.Size(73, 25);
			this.txtDevName.TabIndex = 30;
			this.txtDevName.Text = "";
			// 
			// Label5
			// 
			this.Label5.AutoSize = true;
			this.Label5.BackColor = System.Drawing.SystemColors.Control;
			this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label5.Location = new System.Drawing.Point(8, 24);
			this.Label5.Name = "Label5";
			this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label5.Size = new System.Drawing.Size(80, 13);
			this.Label5.TabIndex = 29;
			this.Label5.Text = "Device name =";
			// 
			// Label1
			// 
			this.Label1.AutoSize = true;
			this.Label1.BackColor = System.Drawing.SystemColors.Control;
			this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label1.Location = new System.Drawing.Point(216, 24);
			this.Label1.Name = "Label1";
			this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label1.Size = new System.Drawing.Size(84, 13);
			this.Label1.TabIndex = 3;
			this.Label1.Text = "GPIB address =";
			// 
			// Frame3
			// 
			this.Frame3.BackColor = System.Drawing.SystemColors.Control;
			this.Frame3.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.txtAddr,
																				 this.cmdSearch,
																				 this.cboEoi,
																				 this.cboDelim,
																				 this.cboAddr,
																				 this.Label4,
																				 this.Label3,
																				 this.Label2});
			this.Frame3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame3.Location = new System.Drawing.Point(8, 80);
			this.Frame3.Name = "Frame3";
			this.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame3.Size = new System.Drawing.Size(545, 94);
			this.Frame3.TabIndex = 60;
			this.Frame3.TabStop = false;
			this.Frame3.Text = "Target information";
			// 
			// txtAddr
			// 
			this.txtAddr.AcceptsReturn = true;
			this.txtAddr.AutoSize = false;
			this.txtAddr.BackColor = System.Drawing.SystemColors.Window;
			this.txtAddr.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtAddr.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtAddr.Location = new System.Drawing.Point(96, 19);
			this.txtAddr.MaxLength = 0;
			this.txtAddr.Name = "txtAddr";
			this.txtAddr.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtAddr.Size = new System.Drawing.Size(81, 21);
			this.txtAddr.TabIndex = 34;
			this.txtAddr.Text = "";
			// 
			// cmdSearch
			// 
			this.cmdSearch.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSearch.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSearch.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSearch.Location = new System.Drawing.Point(424, 56);
			this.cmdSearch.Name = "cmdSearch";
			this.cmdSearch.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSearch.Size = new System.Drawing.Size(113, 29);
			this.cmdSearch.TabIndex = 31;
			this.cmdSearch.Text = "Find listener";
			this.cmdSearch.Click += new System.EventHandler(this.cmdSearch_Click);
			// 
			// cboEoi
			// 
			this.cboEoi.BackColor = System.Drawing.SystemColors.Window;
			this.cboEoi.Cursor = System.Windows.Forms.Cursors.Default;
			this.cboEoi.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboEoi.ForeColor = System.Drawing.SystemColors.WindowText;
			this.cboEoi.Items.AddRange(new object[] {
														"Not use",
														"Use"});
			this.cboEoi.Location = new System.Drawing.Point(288, 56);
			this.cboEoi.Name = "cboEoi";
			this.cboEoi.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cboEoi.Size = new System.Drawing.Size(105, 21);
			this.cboEoi.TabIndex = 25;
			// 
			// cboDelim
			// 
			this.cboDelim.BackColor = System.Drawing.SystemColors.Window;
			this.cboDelim.Cursor = System.Windows.Forms.Cursors.Default;
			this.cboDelim.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboDelim.ForeColor = System.Drawing.SystemColors.WindowText;
			this.cboDelim.Items.AddRange(new object[] {
														  "Not use",
														  "CR+LF",
														  "CR",
														  "LF"});
			this.cboDelim.Location = new System.Drawing.Point(96, 56);
			this.cboDelim.Name = "cboDelim";
			this.cboDelim.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cboDelim.Size = new System.Drawing.Size(105, 21);
			this.cboDelim.TabIndex = 24;
			// 
			// cboAddr
			// 
			this.cboAddr.BackColor = System.Drawing.SystemColors.Window;
			this.cboAddr.Cursor = System.Windows.Forms.Cursors.Default;
			this.cboAddr.ForeColor = System.Drawing.SystemColors.WindowText;
			this.cboAddr.ImeMode = System.Windows.Forms.ImeMode.Disable;
			this.cboAddr.Location = new System.Drawing.Point(184, 19);
			this.cboAddr.Name = "cboAddr";
			this.cboAddr.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cboAddr.Size = new System.Drawing.Size(353, 21);
			this.cboAddr.TabIndex = 23;
			// 
			// Label4
			// 
			this.Label4.BackColor = System.Drawing.SystemColors.Control;
			this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label4.Location = new System.Drawing.Point(8, 56);
			this.Label4.Name = "Label4";
			this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label4.Size = new System.Drawing.Size(73, 20);
			this.Label4.TabIndex = 28;
			this.Label4.Text = "Delimiter =";
			// 
			// Label3
			// 
			this.Label3.AutoSize = true;
			this.Label3.BackColor = System.Drawing.SystemColors.Control;
			this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label3.Location = new System.Drawing.Point(8, 24);
			this.Label3.Name = "Label3";
			this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label3.Size = new System.Drawing.Size(90, 13);
			this.Label3.TabIndex = 27;
			this.Label3.Text = "Target address =";
			// 
			// Label2
			// 
			this.Label2.BackColor = System.Drawing.SystemColors.Control;
			this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label2.Location = new System.Drawing.Point(232, 56);
			this.Label2.Name = "Label2";
			this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label2.Size = new System.Drawing.Size(33, 20);
			this.Label2.TabIndex = 26;
			this.Label2.Text = "EOI =";
			// 
			// Frame1
			// 
			this.Frame1.BackColor = System.Drawing.SystemColors.Control;
			this.Frame1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.cmdRec,
																				 this.txtRec,
																				 this.cmdSend,
																				 this.txtSend});
			this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame1.Location = new System.Drawing.Point(8, 184);
			this.Frame1.Name = "Frame1";
			this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame1.Size = new System.Drawing.Size(545, 94);
			this.Frame1.TabIndex = 58;
			this.Frame1.TabStop = false;
			this.Frame1.Text = "Send / Receive data";
			// 
			// cmdRec
			// 
			this.cmdRec.BackColor = System.Drawing.SystemColors.Control;
			this.cmdRec.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdRec.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdRec.Location = new System.Drawing.Point(424, 56);
			this.cmdRec.Name = "cmdRec";
			this.cmdRec.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdRec.Size = new System.Drawing.Size(113, 29);
			this.cmdRec.TabIndex = 7;
			this.cmdRec.Text = "Receive(&R)";
			this.cmdRec.Click += new System.EventHandler(this.cmdRec_Click);
			// 
			// txtRec
			// 
			this.txtRec.AcceptsReturn = true;
			this.txtRec.AutoSize = false;
			this.txtRec.BackColor = System.Drawing.SystemColors.Window;
			this.txtRec.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtRec.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtRec.Location = new System.Drawing.Point(8, 56);
			this.txtRec.MaxLength = 0;
			this.txtRec.Name = "txtRec";
			this.txtRec.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtRec.Size = new System.Drawing.Size(409, 29);
			this.txtRec.TabIndex = 6;
			this.txtRec.Text = "";
			// 
			// cmdSend
			// 
			this.cmdSend.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSend.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSend.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSend.Location = new System.Drawing.Point(424, 19);
			this.cmdSend.Name = "cmdSend";
			this.cmdSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSend.Size = new System.Drawing.Size(113, 29);
			this.cmdSend.TabIndex = 5;
			this.cmdSend.Text = "Send(&S)";
			this.cmdSend.Click += new System.EventHandler(this.cmdSend_Click);
			// 
			// txtSend
			// 
			this.txtSend.AcceptsReturn = true;
			this.txtSend.AutoSize = false;
			this.txtSend.BackColor = System.Drawing.SystemColors.Window;
			this.txtSend.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtSend.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtSend.Location = new System.Drawing.Point(8, 19);
			this.txtSend.MaxLength = 0;
			this.txtSend.Name = "txtSend";
			this.txtSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtSend.Size = new System.Drawing.Size(409, 29);
			this.txtSend.TabIndex = 4;
			this.txtSend.Text = "";
			// 
			// Frame5
			// 
			this.Frame5.BackColor = System.Drawing.SystemColors.Control;
			this.Frame5.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.cmdLlo,
																				 this.cmdGtl,
																				 this.cmdDcl,
																				 this.cmdSdc,
																				 this.cmdGet});
			this.Frame5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame5.Location = new System.Drawing.Point(576, 16);
			this.Frame5.Name = "Frame5";
			this.Frame5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame5.Size = new System.Drawing.Size(129, 206);
			this.Frame5.TabIndex = 64;
			this.Frame5.TabStop = false;
			this.Frame5.Text = "GPIB Command";
			// 
			// cmdLlo
			// 
			this.cmdLlo.BackColor = System.Drawing.SystemColors.Control;
			this.cmdLlo.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdLlo.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdLlo.Location = new System.Drawing.Point(8, 168);
			this.cmdLlo.Name = "cmdLlo";
			this.cmdLlo.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdLlo.Size = new System.Drawing.Size(113, 29);
			this.cmdLlo.TabIndex = 17;
			this.cmdLlo.Text = "LLO(&O)";
			this.cmdLlo.Click += new System.EventHandler(this.cmdLlo_Click);
			// 
			// cmdGtl
			// 
			this.cmdGtl.BackColor = System.Drawing.SystemColors.Control;
			this.cmdGtl.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdGtl.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdGtl.Location = new System.Drawing.Point(8, 93);
			this.cmdGtl.Name = "cmdGtl";
			this.cmdGtl.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdGtl.Size = new System.Drawing.Size(113, 29);
			this.cmdGtl.TabIndex = 16;
			this.cmdGtl.Text = "GTL(&T)";
			this.cmdGtl.Click += new System.EventHandler(this.cmdGtl_Click);
			// 
			// cmdDcl
			// 
			this.cmdDcl.BackColor = System.Drawing.SystemColors.Control;
			this.cmdDcl.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdDcl.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdDcl.Location = new System.Drawing.Point(8, 130);
			this.cmdDcl.Name = "cmdDcl";
			this.cmdDcl.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdDcl.Size = new System.Drawing.Size(113, 29);
			this.cmdDcl.TabIndex = 15;
			this.cmdDcl.Text = "DCL(&L)";
			this.cmdDcl.Click += new System.EventHandler(this.cmdDcl_Click);
			// 
			// cmdSdc
			// 
			this.cmdSdc.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSdc.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSdc.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSdc.Location = new System.Drawing.Point(8, 56);
			this.cmdSdc.Name = "cmdSdc";
			this.cmdSdc.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSdc.Size = new System.Drawing.Size(113, 29);
			this.cmdSdc.TabIndex = 14;
			this.cmdSdc.Text = "SDC(&C)";
			this.cmdSdc.Click += new System.EventHandler(this.cmdSdc_Click);
			// 
			// cmdGet
			// 
			this.cmdGet.BackColor = System.Drawing.SystemColors.Control;
			this.cmdGet.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdGet.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdGet.Location = new System.Drawing.Point(8, 19);
			this.cmdGet.Name = "cmdGet";
			this.cmdGet.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdGet.Size = new System.Drawing.Size(113, 29);
			this.cmdGet.TabIndex = 13;
			this.cmdGet.Text = "GET(&G)";
			this.cmdGet.Click += new System.EventHandler(this.cmdGet_Click);
			// 
			// Line1
			// 
			this.Line1.BackColor = System.Drawing.SystemColors.WindowText;
			this.Line1.Location = new System.Drawing.Point(568, 16);
			this.Line1.Name = "Line1";
			this.Line1.Size = new System.Drawing.Size(1, 372);
			this.Line1.TabIndex = 67;
			// 
			// cmdInit
			// 
			this.cmdInit.BackColor = System.Drawing.SystemColors.Control;
			this.cmdInit.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdInit.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdInit.Location = new System.Drawing.Point(416, 8);
			this.cmdInit.Name = "cmdInit";
			this.cmdInit.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdInit.Size = new System.Drawing.Size(113, 29);
			this.cmdInit.TabIndex = 57;
			this.cmdInit.Text = "Initialize(&I)";
			this.cmdInit.Click += new System.EventHandler(this.cmdInit_Click);
			// 
			// Form_master
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(712, 430);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.Frame6,
																		  this.cmdExit,
																		  this.cmdRetDel,
																		  this.cmdDataDel,
																		  this.Frame4,
																		  this.Frame2,
																		  this.Frame3,
																		  this.Frame1,
																		  this.Frame5,
																		  this.Line1,
																		  this.cmdInit});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form_master";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Master";
			this.Load += new System.EventHandler(this.Form_master_Load);
			this.Frame6.ResumeLayout(false);
			this.Frame4.ResumeLayout(false);
			this.Frame2.ResumeLayout(false);
			this.Frame3.ResumeLayout(false);
			this.Frame1.ResumeLayout(false);
			this.Frame5.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form_master());
		}

		//**************************************************************************************************
		//   Display transmitted string to list box of "Return code"(sub routine)
		//**************************************************************************************************
		private void funcSetlstRet(string strRet)
		{
			//Add the item to the end of list box
			//Clear all of the items if the number of items more than 256
			if (lstRet.Items.Count >= 256)
			{
				lstRet.Items.RemoveAt(0);
				lstRet.Items.Add(strRet);
			}
			else
			{
				lstRet.Items.Add(strRet);
			}
			lstRet.SelectedIndex = lstRet.Items.Count - 1;
		}

		//**************************************************************************************************
		//   Set the target (sub routine)
		//   Function: Set Equipment ID, Delimiter and EOI
		//   Return value: TRUE(normally), FALSE(abnormally)
		//**************************************************************************************************
		private bool funcSetParam()
		{
			short	Delim;
			short	PrmAddr;
			short	Eoi;
			short	Eos;
			int		Ret;
			string	strRet;

			//If the other party equipment has been detected, the equipment that has been detected is specified. 
			if (cboAddr.Items.Count != 0)
			{
				//Get Equipment ID of the device specified in combo box
				m_SelectEqpId = m_EqpId[cboAddr.SelectedIndex];
			}
			else
			{
				//Get Equipment ID of device address specified in edit box
				Delim	= (short)cboDelim.SelectedIndex;
				PrmAddr	= short.Parse(txtAddr.Text);
				Ret = gpib.SetEquipment(	m_Id,				//Device ID
											out m_SelectEqpId,	//Retrieved equipment ID
											PrmAddr,			//Primary address 
											0,					//Secondary address 
											Delim);				//Set delimiter
				if (Ret != 0)
				{
					//Error
					gpib.GetErrorString(Ret, out strRet);
					funcSetlstRet(strRet);		//Display in list
					return false;
				}
			}
			//Set delimiter code and EOI line
			Delim	= (short)cboDelim.SelectedIndex;
			Eoi		= (short)cboEoi.SelectedIndex;
			Eos		= 0;
			Ret	= gpib.SetDelim(	m_SelectEqpId,
				Delim,			//Set delimiter code
				Eoi,			//Set EOI line
				Eos);			//Set EOS(reserved)
			if (Ret != 0)
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);			//Display in list
			}
			else
			{
				funcSetlstRet("[Partner apparatus setting] completed normally");	//Display in list
			}
			return true;
		}

		//***************************************************************************
		//   Initializing
		//***************************************************************************
		private void Form_master_Load(object sender, System.EventArgs e)
		{
			txtDevName.Text = "GPIB000";
			txtAddr.Text = "1";
			cboDelim.SelectedIndex = 1;	//Set "CR+LF" as default
			cboEoi.SelectedIndex = 1;	//Set "Use" as default
			txtSend.Text = "CONTEC Master Sample";
		}

		//***************************************************************************
		//   Initialize
		//   Function: Get device ID from device name
		//***************************************************************************
		private void cmdInit_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			int		Data;
			string	strRet;

			//Initialization function execution
			Ret = gpib.Init(txtDevName.Text, out m_Id);
			if (Ret != 0)
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			}
			else 
			{
				//If get device ID normally
				strRet = "GpibInit : DeviceID = " + m_Id;
				funcSetlstRet(strRet);	//Display in list
				//Get device address
				Ret = gpib.GetStatus(m_Id, 0x08, out Data);
				if (Ret == 0)
				{
					txtMyAddr.Text = Data.ToString();
				}
				//Confirm whether it is set to master
				Ret = gpib.GetStatus(m_Id, 0x0A, out Data);
				if ((Ret == 0) && (Data == 1)) 
				{
					MessageBox.Show("It is not a master. Please set it to master in property page.");
				} 
				else 
				{
					strRet = "[Initialize] completed normally";
					funcSetlstRet(strRet);	//Display in list
				}
			}
			
			gpib.SendIFC(m_Id, 1);	//Send IFC
		}

		//***************************************************************************
		//   Exit
		//   Function: Disable device ID
		//***************************************************************************
		private void cmdExit_Click(object sender, System.EventArgs e)
		{
			int	Ret;
			string	strRet;

			Ret = gpib.Exit(m_Id);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			}
			this.Close();
		}

		//***************************************************************************
		//   Detect partner apparatus
		//   FuntionF Detect partner apparatus from device ID and get equipment ID.
		//         Send the [*IDN?] command according with IEEE488.2 standard to partner apparatus with
		//         the equipment ID and get device ID(maker and module number etc.).
		//***************************************************************************
		private void cmdSearch_Click(object sender, System.EventArgs e)
		{
			short	PrmAddr;
			short	ScdAddr;
			short	ArraySize;
			short	ArrayCount;
			short[]	AddrArray = new short[32];
			int		Ret;
			int		SendLen;
			int		RecLen;	
			string	RecBuf;
			string	strRet;
			string	SendBuf;
			string	EqpInforBuf;

			PrmAddr		= -1;	//Search all primary address
			ScdAddr		= 0;	//Do not search secondary address
			ArraySize	= 32;	//Specify the number of devices to be detected
			Ret = gpib.FindListener(m_Id, PrmAddr, ScdAddr, ref ArraySize, AddrArray);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
				return;
			} 
			//Display detected partner apparatus when finishing detecting normally
			strRet = "GpibFindListener : the number of detected partner apparatus = " + ArraySize;
			funcSetlstRet(strRet);	//Display in list

			//Get device information of detected device
			cboAddr.ResetText();	//Initialize combo box items
			for (ArrayCount = 0; ArrayCount < ArraySize; ArrayCount++) 
			{
				//Get Equipent ID
				Ret = gpib.SetEquipment(
										m_Id,							//Device ID
										out m_EqpId[ArrayCount],		//Retrieved equipment ID
										AddrArray[ArrayCount],			//Primary address
										0,								//Secondary address
										(short)cboDelim.SelectedIndex	//Set delimiter
										);
				if (Ret != 0) 
				{
					//error
					gpib.GetErrorString(Ret, out strRet);
					funcSetlstRet(strRet);	//Display in list
					continue;
				}
		
				//Inquiry device information(data sending)
				SendBuf = "*IDN?";			//Data to be sent
				SendLen = SendBuf.Length;	//The number of sent data
				Ret = gpib.SendData(m_EqpId[ArrayCount], ref SendLen, SendBuf);
				if (Ret != 0) 
				{
					//error
					gpib.GetErrorString(Ret, out strRet);
					funcSetlstRet(strRet);	//Display in list
					continue;
				}

				//Inquiry device information(data receiving)
				RecLen = 256;	//Specify buffer size for receiving data
				Ret = gpib.RecData(m_EqpId[ArrayCount], ref RecLen, out RecBuf);
				if (Ret != 0) 
				{
					//error
					gpib.GetErrorString(Ret, out strRet);
					funcSetlstRet(strRet);	//Display in list
					continue;
				}

				//Confirm whether receiving data accords with IEEE488.2 standard
				if (RecBuf.IndexOf(",") != -1) 
				{
					//Combine with address information
					EqpInforBuf = "Address:" + AddrArray[ArrayCount] + RecBuf;
				} 
				else 
				{
					//Include only address information if receiving data does not accord with IEEE488.2 standard
					EqpInforBuf = "Address:" + AddrArray[ArrayCount];
				}
				//Add detected device to the list
				cboAddr.Items.Insert(ArrayCount, EqpInforBuf);
				cboAddr.SelectedIndex = ArrayCount;
			}

			//Reflect detected device to combo box and edit box
			if(cboAddr.SelectedIndex != -1)
			{
				txtAddr.Text = AddrArray[cboAddr.SelectedIndex].ToString();
			}
		
		}

		//***************************************************************************
		//   Send Data
		//   Function: Send data to slave device
		//***************************************************************************
		private void cmdSend_Click(object sender, System.EventArgs e)
		{
			int		SendLen;
			int		Ret;
			string	strRet;
			string	SendBuf;

			//Set equipment ID, delimiter and EOI
			if (funcSetParam() == false) return;

			//Get sending data from edit box
			SendBuf = txtSend.Text;
			SendLen = SendBuf.Length;
			if (SendLen == 0) 
			{
				strRet = "GpibSendData : sending data does not exist";
				funcSetlstRet(strRet);	//Display in list
				return;
			}

			funcSetlstRet("GpibSendData : sending data...");	//Display in list
			//Send data
			Ret = gpib.SendData(m_SelectEqpId, ref SendLen, SendBuf);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else  
			{
				//Sent data normally
				strRet = "GpibSendData : the number of sent data = " + SendLen;
				funcSetlstRet(strRet);	//Display in list
				funcSetlstRet("[Send data] completed normally");	//Display in list
			}
		}

		//***************************************************************************
		//   Receive data
		//   Function: Receive data from slave device
		//***************************************************************************
		private void cmdRec_Click(object sender, System.EventArgs e)
		{
			int		RecLen;
			int		Ret;
			string	strRet;
			string	RecBuf;

			//Set equipment ID, delimiter and EOI
			if (funcSetParam() == false) return;

			RecLen = 256;	//Set recieving buffer size
			funcSetlstRet("GpibRecData : receiving data...");	//Display in list
			//Receive data
			Ret = gpib.RecData(m_SelectEqpId, ref RecLen, out RecBuf);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				//Receiv data normally
				txtRec.Text = RecBuf.Substring(0,RecLen);
				strRet = "GpibRecData : the number of received data = " + RecLen;
				funcSetlstRet(strRet);	//Display in list
				strRet = "[Receive data] completed normally";
				funcSetlstRet(strRet);	//Display in list
			}
		}

		//***************************************************************************
		//   Send GET Command
		//   Function: Performs transfer of command (GET) starts the matter decided by slave device.
		//***************************************************************************
		private void cmdGet_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			if (funcSetParam() == false) return;

			//Perform the function of sending GET command
			Ret = gpib.SendTrigger(m_SelectEqpId);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Send GET command] completed normally");	//Display in list
			}	
		}

		//***************************************************************************
		//   Send SDC Command
		//   Function: Perform transfer of commands (SDC) that make slave device to initial states (when power is supplied)
		//***************************************************************************
		private void cmdSdc_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			if (funcSetParam() == false) return;

			//Perform the function of sending SDC command
			Ret = gpib.SendDeviceClear(m_SelectEqpId);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Send SDC command] completed normally");	//Display in list
			}	
		}

		//***************************************************************************
		//   Send GTL command
		//   Function: Transmit the command(GTL) that make slave device return to local mode
		//***************************************************************************
		private void cmdGtl_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			if (funcSetParam() == false) return;

			//Perform the function of sending GTL command
			Ret = gpib.ChangeLocal(m_SelectEqpId);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Send GTL command] completed normally");	//Display in list
			}	
		}

		//***************************************************************************
		//   Send DCL command
		//   Function: Perform transfer of command (DCL) that make all slave devices to initial states (when power is supplied)
		//***************************************************************************
		private void cmdDcl_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			//Perform the function of sending DCL command
			Ret = gpib.SendDeviceClear(m_Id);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Send DCL command] completed normally");	//Display in list
			}
		}

		//***************************************************************************
		//   Send LLO command
		//   Function: Perform transfer of command (LLO) that disables the transition to local mode by switch on device of all slave devices
		//***************************************************************************
		private void cmdLlo_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			//Perform the function of Sending LLO command
			Ret = gpib.SendLocalLockout(m_Id);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Send LLO command] completed normally");	//Display in list
			}	
		}

		//***************************************************************************
		//   Perform serial poll
		//   Function: Get status byte of slave device
		//***************************************************************************
		private void cmdSPoll_Click(object sender, System.EventArgs e)
		{
			short	Stb;
			short	Srq;
			int		Ret;
			string	strRet;

			if (funcSetParam() == false) return;
		
			funcSetlstRet("GpibSPoll : serial polling...");	//Display in list

			//Perform the function of serial poll
			Ret = gpib.SPoll(m_SelectEqpId, out Stb, out Srq);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				strRet = string.Format("GpibSPoll : status byte = {0:X2}(H) SRQ line = {1:X2}(H)" ,Stb, Srq);
				funcSetlstRet(strRet);	//Display in list
				funcSetlstRet("[Serial poll] completed normally");	//Display in list
			}
		}

		//***************************************************************************
		//   Construct parallel poll
		//   Function: set the line of parallel poll response
		//***************************************************************************
		private void cmdSetPPoll_Click(object sender, System.EventArgs e)
		{
			short[]	AddrArray		= new short[9];
			short[]	DataLineArray	= new short[9];
			short[]	PolarityArray	= new short[9];
			int		i;
			int		Ret;
			string	strRet;

			//Set by device address in edit box
			i = 0;
			AddrArray[i]		= short.Parse(txtAddr.Text);	//Device address
			DataLineArray[i]	= (short)(i + 1);				//DIO line number
			PolarityArray[i]	= 1;							//Set as inphase
			i++;

			//Set the end of the array
			AddrArray[i]		= -1;
			DataLineArray[i]	= -1;
			PolarityArray[i]	= -1;

			//Perform the function of counstructing parallel poll
			Ret = gpib.SetPPoll(m_Id, AddrArray, DataLineArray, PolarityArray);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				funcSetlstRet("[Construct parallel poll] completed normally");	//Display in list
			}
		}

		//***************************************************************************
		//   Perform parallel poll
		//   Function: Perform parallel poll and get DIO line data
		//***************************************************************************
		private void cmdPPoll_Click(object sender, System.EventArgs e)
		{
			short	Ppr;
			int		Ret;
			string	strRet;

			//Perform the function of parallel poll
			Ret = gpib.PPoll(m_Id, out Ppr);
			if (Ret != 0) 
			{
				//error
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Display in list
			} 
			else 
			{
				strRet = string.Format("GpibPPoll : DIO line data = {0:X2}(H)", Ppr);
				funcSetlstRet(strRet);	//Display in list
				funcSetlstRet("[Parallel poll] completed normally");	//Display in list
			}
		}

		//***************************************************************************
		//   Clear send/receive text data
		//***************************************************************************
		private void cmdDataDel_Click(object sender, System.EventArgs e)
		{
			txtSend.Text = "";
			txtRec.Text = "";
		}

		//***************************************************************************
		//   Clear return code
		//***************************************************************************
		private void cmdRetDel_Click(object sender, System.EventArgs e)
		{
			lstRet.Items.Clear();
		}


	}
}
