bbb()方法
public string bbb(){ string result = "OK!"; string a = "1"; short i = 1; axRFNCCTL1.Devices.get_Device(i).DataWrite(a + result, (short)(a.Length + result.Length)); return result;}
private void axRFNCCTL1_DataEvent(object sender, AxNRFCCTLCONTROLLib._IRFNCCTLEvents_DataEventEvent e) {
string a = axRFNCCTL1.Devices.get_Device(e.devID).DeviceData.ToString();
setArray(a); bbb();在和bbb()方法同一个程序里调用,这时调用bbb()方法有用。 }
发射调用bbb()方法就没用了,不知道为什么
private object Invoke(string lpProcName, object[] va) { try { // 载入程序集 Type t = MyAssembly.GetType("DataLogic.Form1"); //Type[] type = MyAssembly.GetTypes(); //Type type = MyAssembly. //foreach (Type t in type) //{// 查找要调用的命名空间及类 //if (t.Name == ClassName) //{// 查找要调用的方法并进行调用 MethodInfo m = t.GetMethod(lpProcName); if (m != null) { if (s == false) { o = Activator.CreateInstance(t); s = true; } m.Invoke(o,va); } //else MessageBox.Show(" 装载出错 !"); //} // } }//try catch (System.NullReferenceException e) { MessageBox.Show(e.Message); }//catch return (object)0; }
/// <summary> /// 取数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { object[] strList = aaa.Trim().Replace("'", "").Split('*'); Invoke("bbb", strList).ToString(); 这里就是反射用bbb()方法 }
- 2 回答
- 0 关注
- 424 浏览
添加回答
举报
0/150
提交
取消