mattyboy2000
Programmer
Hi. We've designed our application to dynamically create and call forms using a Different Application domain. We've almost got it working apart from when i want to run a sub that we created ourselves. The reason we are doing this is for the application to first look in the G:\prod\Comp\DLLs folder and if it can't find the DLLs there it will look in G:\eM1\Core\DLLs.
Dim objDomain As AppDomain
Dim objEvidence As Security.Policy.Evidence
Dim strApplicationPath As String
'Create a new domain and run the programs from there
objEvidence = AppDomain.CurrentDomain.Evidence
objDomain = AppDomain.CreateDomain("NewDomain", objEvidence, "G:\", "", False)
objDomain.AppendPrivatePath("prod\Comp\DLLs"
objDomain.AppendPrivatePath("eM1\Core\DLLs"
Dim frmLogin = objDomain.CreateInstanceAndUnwrap("M1Main", "M1Main.frmLogin"
' Hide the system picker and show the login form
Me.Hide()
frmLogin.setdata(Me)
CType(frmLogin, Form).Show()
It all works apart from the Line highlighted in red.
we get the message:
System.MissingMemberException: Public member 'setdata' on type 'MarshalByRefObject' not found.
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at SystemPicker.frmMain.ClickedConnectButton(Object sender, EventArgs e) in G:\M1.net\Development\Sourcecode\GlobalM1\SystemPicker\frmMain.vb:line 225
If you have any ideas please reply.
Thanks
Matt
Dim objDomain As AppDomain
Dim objEvidence As Security.Policy.Evidence
Dim strApplicationPath As String
'Create a new domain and run the programs from there
objEvidence = AppDomain.CurrentDomain.Evidence
objDomain = AppDomain.CreateDomain("NewDomain", objEvidence, "G:\", "", False)
objDomain.AppendPrivatePath("prod\Comp\DLLs"
objDomain.AppendPrivatePath("eM1\Core\DLLs"
Dim frmLogin = objDomain.CreateInstanceAndUnwrap("M1Main", "M1Main.frmLogin"
' Hide the system picker and show the login form
Me.Hide()
frmLogin.setdata(Me)
CType(frmLogin, Form).Show()
It all works apart from the Line highlighted in red.
we get the message:
System.MissingMemberException: Public member 'setdata' on type 'MarshalByRefObject' not found.
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at SystemPicker.frmMain.ClickedConnectButton(Object sender, EventArgs e) in G:\M1.net\Development\Sourcecode\GlobalM1\SystemPicker\frmMain.vb:line 225
If you have any ideas please reply.
Thanks
Matt