开发者

Adding Events to user control in Windows forms

I am using a windows 开发者_开发百科form in which i have a build a usercontrol with one textbox and one CheckedList control. What i wanted to do is i want to capture the ListIndexChanged event of CheckListbox control in my form where i use this usercontrol.

Please help me how to do this


You can add this

public event EventHandler SelectedIndexChanged
{
    add { checkListBox.SelectedIndexChanged += value; }
    remove { checkListBox.SelectedIndexChanged -= value; }
}

to your control and subscribe to this event from the form

take a look here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜