I need to call a large number of methods selecting them from a dropdown box.
Rather than doing a large Switch/Case I use reflection and invokemeber, it works fine, I can send parameters and get a return parameter but I need more than one parameter back.
I can't work out a way to use out parameters with invokemembre.
Here is a working sample of my code w/o the out parameter.
Code:Type t = machineComm.GetType(); object[] param = new object[] { Convert.ToInt16(comboBox6.Text) }; MethodInfo methodName = t.GetMethod(comboBox3.Text); // this is the Method to call retCode = (int)t.InvokeMember(methodName.Name, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, machineComm, param);
Any help appreciated




Reply With Quote