TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Daniel
NA
66
0
Wiring events...need advice
Nov 13 2007 11:23 AM
I have a form with lots of checkboxes on it.
I want to loop through and wire all the checkboxes "checkedchanged" events to a custom method.
Can I loop through InitializeComponent() and wire it up? If so, can someone post some code?
Here is what i was thinking and hope to do. Please offer any advice or better way to do this.
foreach (object obj in this.Controls)
{
if (typeof(obj) == System.Windows.Forms.CheckBox)
{
obj.click += new System.EventHandler(
<custom method>
)
}
}
Thanks
Reply
Answers (
2
)
Which IDE do you prefer ?
Searching an Item in a ComboBox and get its index