private void i2cScanButton_Click(object sender, EventArgs e) { string ipstr = ipAddrTextBox.Text; string gpibAddr = "inst30"; string resp; VXI11Class remote_inst = new VXI11Class(gpibAddr, ipstr); // scan test byte[] i2cInst = new byte[128]; remote_inst.scanI2c(ref i2cInst); i2cRespTextBox.AppendText("i2c scan:\r\n"); for (int k = 3; k < 128; k++) { // if not zero, then i2c instrument is present if (i2cInst[k] != 0) { //Console.WriteLine("Hex: {0:X}", k); resp = String.Format("0x{0:X}", k); i2cRespTextBox.AppendText(resp + "\r\n"); } } i2cRespTextBox.AppendText("\r\n"); remote_inst.close(); }