JM Gonzalez

JM Gonzalez

  • NA
  • 4
  • 0

Using separate class to handle events of Windows user controls

Dec 23 2004 10:07 AM
Good day. I have this scenario wherein I have a number of 'user controls' to be placed on C# Windows forms. These controls are reused which means that they are placed on the forms of our application, depending on the user. I want to keep all of the forms' events in a single separate class called "Events.cs". In summary, these is how it goes: 1. The user chooses which controls to be included in the form. 2. Upon raising an event for a user control (clicking a button), the control will raise an event listed on the separate class (Events.cs). 3. The events class will be the one to access the main form (where the user controls are placed); and do the necessary changes to the form and perform commands like database access. Is this possible? What is the best approach in doing this?

Answers (2)