首页 新闻 会员 周边

发射一个方法疑问,懂得进来看看,高分求救!~

0
悬赏园豆:200 [已解决问题] 解决于 2010-01-07 15:08

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()方法
        }

科比。NET的主页 科比。NET | 初学一级 | 园豆:0
提问于:2010-01-06 13:12
< >
分享
最佳答案
0

反过来反射,我帮你解决!~

收获园豆:200
大草包 | 小虾三级 |园豆:1745 | 2010-01-07 15:06
其他回答(1)
0

查看下线程ID,看是否在同一个线程里。

无之无 | 园豆:5095 (大侠五级) | 2010-01-06 14:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册