User controls allow you to have groups of elements which can be placed on forms.
❌ Bad: User controls can be really misused and placed in forms where they shouldn't be. An example of that is shown below, under the components directory the user controls placed and used only once at a time during the application flow. There is much more coding responsibility on the developer to load those controls correctly one at a time inside the main form.
❌ Figure: Bad example - All the forms in the application are user controls
❌ Figure: Bad example - All of the controls on this form are on a user control, but are only used once
✅ Good: User Controls are best used for recurring or shared logic either on the same form or throughout the application. This encourages code reuse, resulting in less overall development time (especially in maintenance). Example, the figure below shows the good use of User Controls, the address control is repeated three times but coded once.
✅ Figure: Good example - User controls are only used for shared controls
✅ Figure: Good example - The Address User Control is repeated
Exception: User controls can be made for tab pages (e.g Tools | Options) and search pages. This allows the breakdown of complex forms, and development by different developers.
🙂 Figure: User controls are OK in tab pages (exception)
✅ The pros of User Controls are:
❌ However the cons are: