3

Is it possible to have an usercontrol(.ascx) in class libaray(dll) and use the control in other project by referencing the dll. If its not possible or advisable, how should i write my control in a such a way that outside projects can reuse it. Any suggestion would really helpful

Al.
  • 855
  • 1
  • 11
  • 24
  • [Use the user control from dll](https://stackoverflow.com/questions/2101171/how-to-add-user-control-in-the-toolbox-for-c-net-for-winforms-by-importing-the/63792719#63792719) [Add user control in the toolbox](https://stackoverflow.com/questions/2101171/how-to-add-user-control-in-the-toolbox-for-c-net-for-winforms-by-importing-the/63792719#63792719) – Rahul Sutar Sep 08 '20 at 11:17
  • [This link answers the similar question](https://stackoverflow.com/questions/2101171/how-to-add-user-control-in-the-toolbox-for-c-net-for-winforms-by-importing-the/63792719#63792719) – Rahul Sutar Sep 08 '20 at 11:21

2 Answers2

1

Just make sure the properties and functions are public. Then reference the dll from your project and use the control just like you would if it resided in the same project. If this is a control you are going to use from more than one project I would say yes it's a good choice to create a dll and reference it.

Orn Kristjansson
  • 3,435
  • 4
  • 26
  • 40
1

Yes you can kind of do it by using the asp_net complier option for .ascx

Please see this article on msdn gives you step by step details how to do

http://msdn.microsoft.com/en-us/library/aa479318.aspx

HatSoft
  • 11,077
  • 3
  • 28
  • 43