As stated in the question, is there any difference in the meaning of the two as applied to the Controls of .NET. Or are they alias of one another?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
A user control is a composition of existing controls while a custom control is a control derived from one base control. This might be better in stackoverflow btw.
User control: Any control inheriting from
Custom control: Any control inheriting from
User Control These are the existing controls of the framework and are used in conjunction with other controls to facilitate certain actions like Login Control
Custom Control In this case you inherit from the available control and add features which are customized for that control and your needs. something like a datepicker Column in the DataGridView
I don't know if there is a useful distinction between them in the winforms world, but in asp.net (web forms) this is the distinction:
A usercontrol can have declarative markup in a XXXX.ascx file whereas logic is placed in the corresponding XXXX.ascx.cs file. Whenever you want to use the usercontrol you must declare which ascx-file you want to use.
A Custom Control can't have declarative markup, but can be used by just specifying the namespace (for example globally in web.config)
or more succinctly: a usercontrol is mucht easier to write but slightly harder to use, a custom control is (potentially) much harder to write but slightly easier to use.
All the builtin controls shipped from MS are custom controls which makes them easier to use (you don't have to specify an ascx-file to use an asp:Label for instance)
Generally: if you are going to make a control which consists of many sub-controls you would want to go with usercontrol, but if you are extending a standard control with some new logic you'd want to go with custom control