开发者

Adding Events to user control in Windows forms

开发者 https://www.devze.com 2023-01-01 03:49 出处:网络
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 Chec

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

精彩评论

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