Subscribing custom events of custom controls

Class library usage, coding and language questions.
Posts: 1
Joined: Mon Nov 26, 2012 5:10 pm

Subscribing custom events of custom controls

Post by BernieM » 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: ... 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!


PS.: I'm using
- Ranorex
- .NET Runtime Version 3.0.30319.296
- Win7 Prof,64bit, SP1

User avatar
Support Team
Site Admin
Site Admin
Posts: 12173
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Subscribing custom events of custom controls

Post by Support Team » Tue Nov 27, 2012 11:33 am


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.