通过调用访问Combobox项目(C#)

时间:2015-06-12 14:22:11

标签: c# winforms combobox

我在表单中调用usercontrol的方法,但usercontrol中的Combobox不包含调用方法中的任何项。当我在不使用调用的情况下运行相同的方法(即直接在用户控件中放置按钮并运行相同的方法)时,组合框具有项目。代码如下。

Form1中的

代码:

        Type type = ActiveModelControl.GetType();
        var control = Activator.CreateInstance(type);
        MethodInfo method = type.GetMethod("RunSimulation");

        object[] param = new object[] { modelinfo };

        var results = method.Invoke(control, param);
userontrol中的

代码:

    public List<double> RunSimulation(IModel model)
        {
           [other code]   

           List<string> tempSecurityList =

    GetSecurityList(SecurityListComboBox.SelectedItem.ToString());

               [other code]  

        }

0 个答案:

没有答案