Subscribing custom events of custom controls
Posted: Mon Nov 26, 2012 5:45 pm
Hi All,
I'm new to Ranorex and one of the first problems which popped up was to subsribe a custom event of a custom control. I use a C#.NET windows forms application referencing the Ranorex assemblies to first get a proper Ranorex.Control object which refers to my custom control running in an other application which I want to test.
I now would like to subscribe a custom event which I implemented in that control before. I found a site describing the Ranorex.Control.SubscribeEvent method:
http://www.ranorex.com/Documentation/Ne ... eEvent.htm
I guess that would be the solution for my problem. Anyway, they state, that this method is only supported by RanorexPro (which I got licensed here) and .NET 2.0. But I'm running .NET 4.0. Indeed the method is not supported by he Ranroex.Control class. I do not see it by intellisense and get a compile error when trying to compile an invokement of that method.
Is there an alteranative for that method to subscribe events? I tried to define delegates and pass them by using the Ranoirex.Control.InvokeMethod(). But that always produces an exception ( Exception.Message="Action 'invokemethod' failed on element '{Container:myCtrl}'").
Any ideas or hints? Please let me know!
Thanks!
PS.: I'm using
- Ranorex 3.3.1.18438
- .NET Runtime Version 3.0.30319.296
- Win7 Prof,64bit, SP1
I'm new to Ranorex and one of the first problems which popped up was to subsribe a custom event of a custom control. I use a C#.NET windows forms application referencing the Ranorex assemblies to first get a proper Ranorex.Control object which refers to my custom control running in an other application which I want to test.
I now would like to subscribe a custom event which I implemented in that control before. I found a site describing the Ranorex.Control.SubscribeEvent method:
http://www.ranorex.com/Documentation/Ne ... eEvent.htm
I guess that would be the solution for my problem. Anyway, they state, that this method is only supported by RanorexPro (which I got licensed here) and .NET 2.0. But I'm running .NET 4.0. Indeed the method is not supported by he Ranroex.Control class. I do not see it by intellisense and get a compile error when trying to compile an invokement of that method.
Is there an alteranative for that method to subscribe events? I tried to define delegates and pass them by using the Ranoirex.Control.InvokeMethod(). But that always produces an exception ( Exception.Message="Action 'invokemethod' failed on element '{Container:myCtrl}'").
Any ideas or hints? Please let me know!
Thanks!
PS.: I'm using
- Ranorex 3.3.1.18438
- .NET Runtime Version 3.0.30319.296
- Win7 Prof,64bit, SP1