Load FORM dymanic from DLL (Solved)
Hi All,
With the following code I load a form dynamic form a DLL.
The procedure works fine, but the problem is that I can only load forms
without input parameters.
I tryed a few things, but I don't know how the resolve this,
(Is there a solution for ????)
Can somebody help me.
Thanks in advanced,
AXH
VB Code:
Dim Type As String = "<dllname>.<formname>"
Dim asmAssemblyContainingForm As [Assembly] = [Assembly].LoadFrom(<dllname>.dll)
Dim typetoload As Type = asmAssemblyContainingForm.GetType(Type)
Dim GenericInstance As Object
GenericInstance = Activator.CreateInstance(typetoload)
Dim frm As Form = CType(GenericInstance, Form)
frm.ShowDialog()
frm.Dispose()
GC.Collect()
Re: Load FORM dymanic from DLL
Assuming the contructor takes 1 string argument and 1 integer argument
VB Code:
Dim Type As String = "<dllname>.<formname>"
Dim asmAssemblyContainingForm As [Assembly] = [Assembly].LoadFrom("<dllname>.dll")
Dim typetoload As Type = asmAssemblyContainingForm.GetType(Type)
Dim GenericInstance As Object
Dim Arguments() As Object = {CType("Hello", Object), CType(132, Object)}
GenericInstance = Activator.CreateInstance(typetoload, Arguments)
Dim frm As Form = CType(GenericInstance, Form)
frm.ShowDialog()
frm.Dispose()
GC.Collect()
Re: Load FORM dymanic from DLL (Solved)