private void btn_Query_Click(object sender, EventArgs e) { IRP1.Gpi_800 order = new IRP1.Gpi_800(); if (reader.Send(order, 1000)) { Byte b = order.ReceivedMessage.QueryData[0]; Byte c = order.ReceivedMessage.QueryData[1]; if ((b & 0x01).ToString() == "0") { tbGPI1.Text = "Low"; } else { tbGPI1.Text = "High"; } if ((b & 0x02).ToString() == "0") { tbGPI2.Text = "Low"; } else { tbGPI2.Text = "High"; } } /* * textBox8.Text = comboBox7.Items[(b & 0x02) >> 1].ToString(); * textBox9.Text = comboBox5.Items[b & 0x01].ToString(); * if (textBox2.Enabled) * textBox2.Text = comboBox10.Items[(b & 0x04) >> 2].ToString(); * if (textBox1.Enabled) * textBox1.Text = comboBox9.Items[(b & 0x08) >> 3].ToString(); * } * else * { * groupBox2.Enabled = false; * } */ }
private void btn_Query_Click(object sender, EventArgs e) { IRP1.Gpi_800 order = new IRP1.Gpi_800(); if (reader.Send(order, 1000)) { Byte b = order.ReceivedMessage.QueryData[0]; textBox8.Text = comboBox7.Items[(b & 0x02) >> 1].ToString(); textBox9.Text = comboBox5.Items[b & 0x01].ToString(); if (textBox2.Enabled) { textBox2.Text = comboBox10.Items[(b & 0x04) >> 2].ToString(); } if (textBox1.Enabled) { textBox1.Text = comboBox9.Items[(b & 0x08) >> 3].ToString(); } } else { groupBox2.Enabled = false; } }