-
Oct 16th, 2019, 05:51 AM
#1
Thread Starter
Member
Forms in DLL files?
Hi,
Can you create dll files with forms/gui in them, or can they only contain code?
Thanks,
Sijcooke
-
Oct 16th, 2019, 06:37 AM
#2
Re: Forms in DLL files?
Forms are just classes like any other. Of course you can create them in DLLs. The Form class itself is defined in a DLL, as are all the control classes you can put on a form. Just as with any other type, you need to have referenced the required libraries. When you create a project, select Windows Forms Control Library rather than Class Library and the required assemblies will be referenced by default, i.e. the same ones as for a Windows Forms Application project.
-
Oct 16th, 2019, 09:34 AM
#3
Re: Forms in DLL files?
If you are doing Windows Forms, and you create a Class Library, you just need to add a reference to Windows.Forms to get all that functionality. That may be the sole difference between Windows Forms Control Library (which I hadn't heard of) and a typical Class Library (which is what I use for all dll projects).
My usual boring signature: Nothing
-
Oct 16th, 2019, 09:42 AM
#4
Re: Forms in DLL files?
The Windows Forms Control Library has some additional assembly references and namespace imports, e.g. System.Drawing. The other main difference is that the default item is a user control rather than a simple class. No help if you don't want a user control, of course, but it can be deleted easily enough. Mind you, if you do create a Class Library project and then add a Windows Form item to it in the Solution Explorer, the required references will be added automatically, although the namespace imports will not. That rather begs the question of why this needed to be asked in the first place. Simply trying to add a form would have made it obvious that it was possible. You really ought to always look first and ask questions later.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|