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?
4 Answers
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.

- 5,462
- 22
- 26
-
1Thanks. I was actually caring for definition and I feel this isn't any direct Programming/Software question. – Shamim Hafiz - MSFT Aug 19 '11 at 10:12
-
This is so funny. If you would've posted on StackOverflow it would've been tagged as not programming related. Damn if you do, damn if you don't. – ScottN Nov 17 '15 at 20:21
-
@ShamimHafiz - its a specific question about a feature in a specific programming technology, so it definitely would fit in SO. [Choosing between SO and SE](https://meta.stackoverflow.com/a/254571/199364). For example, its quite similar to [this SO question](https://stackoverflow.com/questions/1322451/what-is-the-difference-between-user-control-custom-control-and-component). If you had asked for general definition of some SE terminology, *not* specifying .Net/WinForms, then it would likely be better in SE, as it would not have an objectively verifiable answer. – ToolmakerSteve Mar 17 '19 at 15:48
User control: Any control inheriting from UserControl
class; These types of controls have a markup associated with them and can have code-behind based on the type of project you have (whether your project is a website or a web application). These controls are not good for re-usability across projects. They are very good candidates to be used as Views in MVC (Model-View-Controller).
Custom control: Any control inheriting from Control
, or WebControl
or CompositeControl
or DataBoundControl
or some other base classes in .NET. These controls don't have associated markup with them. They are pretty good for being encapsulated inside a DLL and being reused across multiple projects. Custom controls usually need more understanding of how web works and you usually overwrite CreateChildren
or Render
method to determine the output of the control.

- 18,142
- 23
- 87
- 125
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

- 594
- 3
- 9
-
So simply put, without working in Microsoft, I wont be able to create any Uswer Control, but only to use them, but can create Custom Controls, right? – Shamim Hafiz - MSFT Aug 19 '11 at 10:13
-
@ShamimHafiz - No, you can create User Control just as easily as Custom Control; this answer is wrong in its definition of User Control. – ToolmakerSteve Mar 17 '19 at 15:37
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

- 271
- 2
- 5