|
-
Mar 31st, 2005, 04:12 PM
#1
Thread Starter
Member
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()
Last edited by ahollaar; Apr 2nd, 2005 at 04:04 AM.
Reason: Problem solved
-
Mar 31st, 2005, 06:13 PM
#2
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()
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Apr 2nd, 2005, 04:03 AM
#3
Thread Starter
Member
Re: Load FORM dymanic from DLL (Solved)
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
|