Is there a prettier way to handle lots of controls with lots of Click events?

Sounds like a silly questions.  I used to program in VS (VB and C++) quite awhile ago.  I'm back in the MS world of programming and like a lot of the new features.  However, I'm wondering if we can group the click events or maybe create a subclass in the main class to handle the events.  

In short, I'm looking at a class that is more than 20 pages long with a lot of methods and click events, thinking there has got to be a better way.  Any ideas?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Might depend on what you're click-event-handling method look like.  Are they all very similar to eaach other, and/or is there a lot of overlapping/duplication functionality that could be abstracted into helpful methods, etc.

Also, if you're looking at a single page/form/control that has a lot of UI elements (and their respective event handlers) all over it, it might be worth grouping those elements into composite controls that each focus on a certain functional group.  (So you could have a page/form that has a handful of controls, and each control contains a handful of child controls, etc.)

It'd be difficult to be much more specific without seeing some examples of what you're dealing with...
Normally, we create an Handler for a user-defined event. to event of .NET control, such as, click, load, etc. we need to use System.EventHandler. If we define a delegate and event for our user control, it's ok too.
Your idea sound good if we group all reuse function in a class. Then use it for our event handler.
If you have two or more button which is handled by the same function, we use this:
this.button1.Click += new System.EventHandler(this.MyHandler_Click);
this.button2.Click += new System.EventHandler(this.MyHandler_Click);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pdlarueAuthor Commented:
Thank you, nguyenvinhtu, your answer leads me to believe that .NET code can be written using the standard Microsoft default structure or it can be written using a more Java like structure.  If this is true then we can write these events in a separate class for reusability.  I will explore this concept further.  Thank you for your reply.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.