alanchinese Posted January 19, 2005 Posted January 19, 2005 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? Quote
donnacha Posted January 20, 2005 Posted January 20, 2005 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..... Quote Hamlet
Administrators PlausiblyDamp Posted January 20, 2005 Administrators Posted January 20, 2005 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.