Page 1 of 1

Select item on dataTimePickerFrom

Posted: Mon Jun 07, 2010 5:46 pm
by rj-nora
Hi, at this moment i need to ask if it is possible to select or set a value on a dataTimePicker from a string using code, when i click to open i have a Form you can see on the attach picture.
string one = 02/12/2008.This time i can't search for the value to match, i have to set the value of the control...How can i do that?

public static void UserCodeMethod1()
{
string startDate = "01/02/2008";
Ranorex.Form rtcForm = ("/form[@controlname='RTCMain']");
Ranorex.DateTime DataTime = rtcForm.FindSingle("/form[@controlname='RTCMain']/container[@controlname='myTimeSel']/container/tabpagelist/tabpage[@controlname='tabTimeframe']/container/datetime[@controlname='dateTimePickerFrom']");


DataTime.Value.....


Thank you

Re: Select item on dataTimePickerFrom

Posted: Mon Jun 07, 2010 6:07 pm
by Ciege
I don't think there is a way to select dates from the calendar element directly without using imaging.
Reading this post http://www.ranorex.com/forum/post4063.h ... time#p4063 discusses setting the value of the dateTime instance.
What I do in my testing is to get the RXPath to the text box that lives under the dateEdit element and enter the date text there. This way I can enter any date information I want into the AUT without having to go directly through the calendar element.

Re: Select item on dataTimePickerFrom

Posted: Tue Jun 08, 2010 11:05 am
by rj-nora
Hi Ciege thanks for your help, my problem is different as you can see on the snapshot i attach on this post, i don't have a text box while exploring the control with Ranorex Spy i only catch the DateTimePicker and inside a List...but when i open the button appears the Calendar Form..Neither I can search for the date on the ListItems because i need to open the list, but the open button brings the Calendar Form...

However manually i can set the value of the control like you can see on the other attach, first the year, then the month and then the day, however i can't change the "/" only the date...

How can i solve this?

Regards

Re: Select item on dataTimePickerFrom

Posted: Tue Jun 08, 2010 12:53 pm
by Support Team
Hi,
rj-nora wrote:How can i solve this?
On that way you should be able to set the value of a "dateTimePicker"
Ranorex.DateTime dateTimeDateTimePicker = "pathToDateTimePicker";
dateTimeDateTimePicker.Value = System.DateTime.Parse("16/12/2010"));
Regards,
Peter
Ranorex Support Team

Re: Select item on dataTimePickerFrom

Posted: Tue Jun 08, 2010 1:43 pm
by rj-nora
Hello , thank you very much! one more problem solved ;)

Re: Select item on dataTimePickerFrom

Posted: Wed Nov 02, 2011 8:00 pm
by jtruppia
This hasn't been useful to me, Value property has no setter.
I had to resort to the method here http://www.ranorex.com/forum/datetimepicker-t1141.html