I added to my project refernces an AciveX control, the enviroment created the wrapper as expected.
But when I try to use it, the compiler requires to cast the objects, example:
MyActiveXObj myObj = (MyActiveXObj)TheControl.MyObj;
but it fails at run time with invalid casting exception.
To test it I switched to Visual Basic.Net and it works without problem, the following line compiles and executes just fine:
Dim myObj as MyActiveXObj
myObj = TheControl.MyObj
What I am doing wrong in C# ?
But when I try to use it, the compiler requires to cast the objects, example:
MyActiveXObj myObj = (MyActiveXObj)TheControl.MyObj;
but it fails at run time with invalid casting exception.
To test it I switched to Visual Basic.Net and it works without problem, the following line compiles and executes just fine:
Dim myObj as MyActiveXObj
myObj = TheControl.MyObj
What I am doing wrong in C# ?