dll reference?

alanchinese

Regular
Joined
Jan 12, 2005
Messages
62
i want to see if there is a way to show a form from another project according the dll name string passed by the users.

Public Sub ShowOneForm(ByVal dllName as String)
Dim oneForm
Select Case (dllName)
Case "FormA":
oneForm = new CustomFormA()
Case "FormB":
oneForm = new CustomFormB()
Case "FormC":
oneForm = new CustomFormC()
End Select
oneForm.Show()
End Sub

anyway to remove the select case block and achieve everything with one simple statement?
 
Once you have included a refernce to the dll in your project then you should be able to use the NameSpace of that dll to access the form.

NameSpace_xx.CustomFormA etc.....
 
Are the forms all declared within a single Dll or in separate ones?
Either way you are probably better off looking at creating a framework for how these forms get used. One way is to define a base form in a separate dll and if anyone requires the ability to create their own forms for your app to use then the must inherit from this base form (or you could choose to define an interface - the basic idea is the same)
When your function is called they would be required to provide the fully qualified name (namspace.formname) and via the reflection API you could then load the correct dll and instantiate the form for them.
A good starting point is Divil's Plugin Tutorial as this will cover the basic ideas of what is required.
 
Back
Top