private void queryButton_Click(object sender, EventArgs e) { string ipstr = ipAddrTextBox.Text; string gpibAddr = "inst" + gpibAddrTextBox.Text; string cmd = commandComboBox.Text; Console.WriteLine(cmd); VXI11Class remote_inst = null;// new VXI11Class(gpibAddr, ipstr); //string resp = string.Empty; byte[] resp = null; try { remote_inst = new VXI11Class(gpibAddr, ipstr); /* if (LockDeviceCheckBox.Checked) * { * // device lock is requested, min 1000 ms is chosen for demo * // * if (Convert.ToInt32(timeOutTextBox.Text) >= 1000) * { * //resp = remote_inst.query(cmd, Convert.ToInt32(timeOutTextBox.Text)); * resp = remote_inst.queryByte(cmd, Convert.ToInt32(timeOutTextBox.Text)); * } * } * else * { * //resp = remote_inst.query(cmd); * resp = remote_inst.queryByte(cmd); * }*/ resp = remote_inst.queryByte(cmd); } catch (Exception ex) { //resp = ex.ErrorCode.ToString(); //resp = ex.Message; throw ex; } string readstring = System.Text.Encoding.ASCII.GetString(resp); //Console.WriteLine(readstring); byte[] bytesAry = resp;// System.Text.Encoding.ASCII.GetBytes(resp);//BitConverter.GetBytes(resp.ToCharArray()); double[] real64 = null; if (binDecode.Checked) { remote_inst.binaryToDouble64(bytesAry, ref real64, swapBinOrder.Checked); if (real64 != null) { readstring = ""; for (int kk = 0; kk < real64.Length; kk++) { if (kk > 0) { readstring += "," + Convert.ToString(real64[kk]); } else { readstring = Convert.ToString(real64[kk]); } } } } responseTextBox.Text += readstring + "\r\n\r\n"; remote_inst.close(); commandComboBox.Items.Add(cmd); }