|
-
Jul 9th, 2009, 12:57 PM
#10
Thread Starter
Fanatic Member
Re: [RESOLVED] Dynamic Object Creation from dll
I need to reference the specific OBJECT within an assembly dynamically. The object name (and any other information needed to create it) can be retreived from the SQL back-end as String information (or numeric, or what have you).
I am trying to avoid a scenario where every time a new form is added to a list of potential forms one might navigate to from a treview, one then has to go code for the addition to either the treeview or other such control which needs to point to the form.
Unless it is possible to somehow, at load, iterate through all of the objects within a certain assembly, and load those which either have a certain prefix or suffix (or even better, implement a certain interface) and load them into a collection. Of course, in that case, I THINK I would end up with a collection of what amounts to single instances, almost like "deault" instances (which I hate), instead of a fresh instance each time the user sleected a certain tree node from the list.
Does that make sense?
I am having trouble explaining this, but an example might be the "add user" pop-up within SQL Server management studio. To the left is a treeview. To the right, panels are loaded depending upon which Treenode is selected. In MY case, I want to be able to add a new panel at some later point, which may have totsally different conrtrols. The panel would be built within an external assembly, and implement a common interface which the container form would recognize.
At Load, the container form would retreive a collection of values from a table in SQL Serve corresponding to the panel items it should load, and place them (or pointers to the objects created from them) into the TreeNode (possibly in the "Tag" property). This way, the Host form will NOT know until runtime what menu items to list; therefore, the object (form) to be shown for each Tree Item has to be retrieved dynamically. If the external .dll needed to be re-compiled after the addition, or a new reference set after a new Form is added, fine. Right?
Last edited by RunsWithScissors; Jul 9th, 2009 at 01:07 PM.
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
|