Forum Discussion
YMinaev
14 years agoStaff
Hi,
The problem is that you pass a control located in your application to a method from an external assembly. This is not allowed, and you get an exception. You need to load your assemby to your application's appdomain and use its dotNet object instead of CLR Bridge.
For example:
The problem is that you pass a control located in your application to a method from an external assembly. This is not allowed, and you get an exception. You need to load your assemby to your application's appdomain and use its dotNet object instead of CLR Bridge.
For example:
Sub loadAssembly(appDomain, name)
Dim assemblyName
Set assemblyName = dotNET.System_Reflection.AssemblyName.zctor_2(name)
Call appDomain.Load_2(assemblyName)
End Sub
'...
Function DoesTextFitOnControl(control)
Set appDomain = Sys.Process("MyApp").AppDomain("MyApp.exe")
name = "MyAssembly,Version=1.0.0.0,Culture="""",PublicKeyToken=something"
Call loadAssembly(appDomain, name)
Set validator = appDomain.dotNET.TextValidation.ControlTextValidator.zctor
' the rest of your code
End Function