无法在C#中将EventHandler作为参数传递

时间:2018-10-20 18:05:44

标签: c# events event-handling eventhandler

我收到此错误:

“ ListControl.SelectedValueChanged”事件只能出现在+ =或-=

的左侧

Visual Studio说“ c.SelectedValueChanged”的类型为EventHandler

public Events ComboBox()
{
    var c = new ComboBox();
    return new Events(c,c.SelectedValueChanged); //Error
}


...


public class Events
{
    public object control
    public object events;

    public Events(Control c,EventHandler e)
    {
        control = c;
        events = e;
    }
}

0 个答案:

没有答案