Select item on dataTimePickerFrom

Ask general questions here.
rj-nora
Posts: 38
Joined: Thu Mar 11, 2010 3:56 pm

Select item on dataTimePickerFrom

Post by rj-nora » Mon Jun 07, 2010 5:46 pm

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
Attachments
dataTimePicker.rxsnp
snapshot
(3.26 KiB) Downloaded 253 times
Last edited by rj-nora on Tue Jun 08, 2010 10:51 am, edited 1 time in total.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Select item on dataTimePickerFrom

Post by Ciege » Mon Jun 07, 2010 6:07 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

rj-nora
Posts: 38
Joined: Thu Mar 11, 2010 3:56 pm

Re: Select item on dataTimePickerFrom

Post by rj-nora » Tue Jun 08, 2010 11:05 am

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
Attachments
Untitled.jpg
Shot
Untitled.jpg (11.07 KiB) Viewed 1594 times
test2.rxsnp
Snapshot of the control
(3.28 KiB) Downloaded 238 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Select item on dataTimePickerFrom

Post by Support Team » Tue Jun 08, 2010 12:53 pm

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
.
Image

rj-nora
Posts: 38
Joined: Thu Mar 11, 2010 3:56 pm

Re: Select item on dataTimePickerFrom

Post by rj-nora » Tue Jun 08, 2010 1:43 pm

Hello , thank you very much! one more problem solved ;)

jtruppia
Posts: 11
Joined: Sat Oct 22, 2011 12:35 am

Re: Select item on dataTimePickerFrom

Post by jtruppia » Wed Nov 02, 2011 8:00 pm

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