private void btnRead_Click(object sender, EventArgs e) { byte[] res = modTCP.ReadKeepReg(0, 2); for (int i = 0; i < res.Length; i++) { lstRead.Items.Add(res[i].ToString()); } }
//第二步:编写委托方法 private byte[] GetData(ModTCP modTCP) { try { return(modTCP.ReadKeepReg(0, 8)); } catch (Exception) { return(null); } }