Page 1 of 1

Subscribing custom events of custom controls

Posted: Mon Nov 26, 2012 5:45 pm
by BernieM
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

Re: Subscribing custom events of custom controls

Posted: Tue Nov 27, 2012 11:33 am
by Support Team
Hello,

You could try to use the method 'InvokeRemotely' to get the data from your control. Have you already read the blog 'Transfering data to and from a .NET control'?
Maybe this blog can help you with your issue.
If this will not help, please let me know.

Regards,
Bernhard