Ranorex

DateTime Picker

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
behdad



Joined: 22 Nov 2006
Posts: 16
Location: Australia

PostPosted: Thu Jan 11, 2007 7:13 am    Post subject: DateTime Picker
Hi,

I am having some difficulty to set and get date on a control which seems to be of type SysDateTimePick32. Unfortunately when I create an object of type DateTimePicker using this control's handle, then I can't just set its text to the value I want. How do I do that. The control looks like the one in the following page at the top which is showing the value 6/16/70:


http://www.codeguru.com/cpp/controls/controls/dateselectioncontrolsetc  /article.php/c2229/

Thank you for your help.

Cheers,
Behdad.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Thu Jan 11, 2007 10:00 pm    Post subject:
You can read the datetime value of the control with the element value property as follows:
Code: click into code to enlarge
dtControl = form.FindClassName("SysDateTimePick32");
Element dtElement = dtControl.Element.FindChild(Role.DropList);
Console.WriteLine("Time-String: " + dtElement.Value);


Unfortunately you cannot set the datetime value on the same way, but you can use the sendkey function (e.g. 11.01.2007):
Code: click into code to enlarge
dtControl.Focus();
dtControl.SendKeys("11{RIGHT}01{RIGHT}2007");

Gabor Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
behdad



Joined: 22 Nov 2006
Posts: 16
Location: Australia

PostPosted: Fri Jan 12, 2007 1:35 am    Post subject:
Hi Gabor,

Thank you. I was more interested in setting and it did work.

Cheers,
Behdad.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum