in Ranorex 9.0:
1 Create a recording , with example name MyGenericDatePicker
2 Create a user code collection
within this usercode collection "Insert New User Code Method" functionality from the context menu,
code should like this :
using mygenericfolder.datepickerrecodinglocation; /// important to add the correct recording object
namespace mygenericCallRecdings
{
/// <summary>
/// Creates a Ranorex user code collection. A collection is used to publish user code methods to the user code library.
/// </summary>
[UserCodeMethod]
public static void CallMyGenericDatePicker(string SomeDate)
{
var CallThisRecording = new MyGenericDatePicker (); /// use object so recording name is only once in the usercode
CallThisRecording.Instance.parameter1 = SomeDate; /// you only need this line if you need parameters to be assigned
TestModuleRunner.Run(CallThisRecording); /// rock&roll
}
}
Important : in the usercode collection Add a Using statement for the directory where MyGenericDatePicker recording is residing, otherwise you can not reference it.
(Save & build your project)
3 NOW from any other recording in your project use the "Add new action button" select "UserCode" with "Select from Library" ,the library will popup with your newly generic MyGenericDatePicker.
Good Luck!
(Edit: updated the code & comments )