4 Replies - 2394 Views - Last Post: 03 October 2012 - 08:18 AM Rate Topic: -----

#1 the5thelement  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 30-July 12

Control Form From .DLL

Posted 30 September 2012 - 06:14 AM

Hello! I have a quick questions about DLL files. I have been working with them for about three days and still cannot figure out how I can use a DLL to control lets say a combobox on form1. I know how to add subs and add the code to them and then call the sub from within the form. But controlling a from object escapes me.
Is This A Good Question/Topic? 0
  • +

Replies To: Control Form From .DLL

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: Control Form From .DLL

Posted 30 September 2012 - 06:31 AM

I get the feeling that you are trying to use DLL's for the wrong purpose. They are meant to promote the reuse of code and to avoid code duplication. The idea is that you have a DLL which is let's say responsible for file manipulation or something. The DLL file would contain a bunch of classes to allow loads of developers to do this, without knowing what kind of program the developer is making. It really doesn't matter.

That's why you find code libraries in the form of DLL's. You include them in your project and use their classes/methods. They shouldn't bind themselves to your application at all or 'control' a combobox on form1. This is the responsibility the app itself, not the DLL's it relies on.

That's not to say you can't have anything to do with Forms in a DLL - you can. For example you could provide a custom control that sets it own look and feel. It will not however control the rest of your application. You simply are supposed to use it in your application, and within many others without changing the source.
Was This Post Helpful? 0
  • +
  • -

#3 the5thelement  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 30-July 12

Re: Control Form From .DLL

Posted 30 September 2012 - 07:34 AM

Okay thanks for the info. I wasn't quite sure about it.
Was This Post Helpful? 0
  • +
  • -

#4 jhouns  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 100
  • Joined: 21-December 09

Re: Control Form From .DLL

Posted 03 October 2012 - 08:01 AM

On the contrary you can do almost anything with a DLL. I personally have a program utilising a plugin architechture via DLLs. If you are just using them as references then I'll mostly agree with the post above me. However if you use a plugin architechture you can have it create controls on the form, modify them and use them consistently via an API.
Was This Post Helpful? 1
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2268
  • View blog
  • Posts: 9,482
  • Joined: 29-May 08

Re: Control Form From .DLL

Posted 03 October 2012 - 08:18 AM

Forms ain't special they are just a class like most of the other things provide in the .net framework. So you want you can provide your projects a common set of forms to utilize, via a DLL.

I tend to separate my solutions in sub projects.
  • Interfaces
  • Base Classes
  • Concrete implementations
  • Library Modules
  • GUI Layers
  • Application

Then export and share the useful and common functionality. I make them into NuGet Packages. Storing them inside a (local) shared library folder, so future projects and solutions can utilize them.

This post has been edited by AdamSpeight2008: 03 October 2012 - 08:26 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1