I have my main project and using reflection I was able to call a method of another class library (dll), but this one, despite the fact that if it enters to read the instructions (debug) and does not give errors at run time, it does not perform no action.
Yes, it is referenced correctly.
This is how I execute a method (which is also public) that is in another library.
Dim magicType As Type = _ensamblador.GetType(GetNamespacesInAssembly(_ensamblador) & "." & _ultimoControl.Name.ToString)
Dim magicConstructor As ConstructorInfo = magicType.GetConstructor(Type.EmptyTypes)
Dim magicClassObject As Object = magicConstructor.Invoke(New Object() {})
Dim magicMethod As MethodInfo = magicType.GetMethod("NombreDelMétodo")
magicMethod.Invoke(magicClassObject, New Object() {})
It works correctly, but in:
Public Sub NombreDelMétodo()
_common.CleanAllControls(gbx_sistema)
_common.CleanAllControls(gbx_modulos)
_common.CleanAllControls(gbx_submodulos)
_common.CleanAllControls(gbx_transferir)
InitialConfig()
'Refresh()
End Sub
When the system is running, I can't see the changes in real time. I tried to call the Refresh method to my User Control, to the panel where all the form controls are loaded but nothing. Any idea what I might be missing? Thank you very much.
Friends I found the solution, because I realized that I was not using the same instance, and as I know, well because I forced myself to print in a message with the ID of the instance (something like the PID) and I realized I realized that they were totally different processes haha, so what I did was just substitute the assembly variable right when I created the instance. The code would be the following:
I optimized the code as follows:
I even put (what is already learned when using OOP) in case the method uses parameters.
It works correctly, if anyone has any questions I will gladly help. Cheers