locked
How to pick a date from wincalendar control RRS feed

  • Question

  • Hi,

    I would like to pick a date from WinCalendar. I used SelectionRangeAsString property and i specified some date to this property to pick date from the calendar but it's select some other date.

    Please suggest..

    Thanks

    Aarti

    Sunday, September 1, 2013 11:09 AM

Answers

All replies

  • Hello,

    Thank you for your post.

    Just to make the issue clearly, are you working with Coded UI Test? I mean that whether you want to pick a date from WinCalendar in Visual Studio Coded UI test?

    If you are doing Coded UI test, do you mean that it is selecting other date during playback? In this case, please check the error debug trace to see if there are any useful information about this WinCalendar control. If possible, you can post the log information here so that we can further look at this issue.

    In addition, if you are hand coding the coded UI test, please record actions using Coded UI Test Builder to pick a date from WinCalendar control to create the coded UI test and then run it to check if the same issue will occur.

    If you want to pick a date from WinCalendar in an application such as Windows Forms app, I am afraid that it is not a correct forum. In this case please provide us clear information so that we can check if this thread can be moved to a more appropriate forum.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 2, 2013 6:45 AM
  • Hi,

    yes, I am working with Visual Studio Coded UI test. I  want to pick a date from WinCalendar in Visual Studio Coded UI test. yes, during playback also it is selecting other date.

    I am not getting any error because first it selects specified date which is assigned to SelectionRangeAsString property of wincalendar then it selects some other date.

    I checked by recording actions using Coded UI Test Builder to pick a date from WinCalendar control and ran the  coded UI test  but same issue occurs.

    Thanks





    Tuesday, September 3, 2013 10:28 AM
  • Hello,

    I am not very sure about your application. If you get the same issue when you run the test generated through action recording using Coded UI Test Builder, I doubt that if it is related to your app.

    Whether some other date will be clicked when you pick a date from Calendar control manually rather than with Coded UI Test? In this case, the issue should be on your application. Please contact your development team to check if it is by design.

    When you record actions to pick a date from the Calendar control, whether other date also will be selected? If yes, when you run test, selecting other date is expected. Coded UI Test plays back what it records.

    Or other date will not be selected when you operate the app manually but other date will be selected when you record actions using Coded UI Test Builder?

    Please provide us more information so that we can further look at this issue.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Amanda Zhu Wednesday, September 11, 2013 1:28 AM
    • Unmarked as answer by Kumari Aarti Thursday, September 19, 2013 10:55 AM
    Wednesday, September 4, 2013 2:32 AM
  • Thanks for your response

    I am new in testing. I have created a test application with a button and a text box in it. When I click on the button, it opens a calendar control. When I select a particular date, the selected date will get added to text box. This application works when i run manually.

    Now - I am trying to do the same functionality through coded UI. I use the following code:

    WinWindow calwin = new WinWindow();
    calwin.SearchProperties.Add("Name", "Form1");

    WinButton btn = new WinButton(calwin);
     btn.SearchProperties.Add(WinButton.PropertyNames.Instance, "1");
    Mouse.Click(btn);

    WinWindow cw = new WinWindow();
    cw.SearchProperties.Add("Name", "FrmMonthCalendar");

    WinCalendar cal = new WinCalendar(cw);
    cal.SearchProperties.Add(WinCalendar.PropertyNames.Instance , "1");

    //cal.SelectionRange.Start = Convert.ToDateTime("9/19/2013");
    //cal.SelectionRange.End = Convert.ToDateTime("9/19/2013");
    cal.SelectionRangeAsString = "9/19/2013";

    At this point - I get another date in my textbox which was not selected. eg. 9/11/2013

    Could you please help what is wrong in this code? 

    Thanks in Advance

    Wednesday, September 18, 2013 2:48 PM
  • Hello,

    If you use the following code snippet:

    cal.SelectionRange.Start = Convert.ToDateTime("9/19/2013");
    cal.SelectionRange.End = Convert.ToDateTime("9/20/2013");

    Whether some other dates out of 9/19/2013 to 9/20/2013 will also be selected?

    Since it is hard for us to repro this issue, maybe you could share us a sample, we try to run it in our PC. Please attach your Visual Studio project and a simple test application, you can upload them to the https://skydrive.live.com/, and then share the download link in your post. Thanks for your understanding

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 23, 2013 3:26 AM
  • Hi,

    I have uploaded calendar test application(Calendar.exe) and scripts to pick date from calendar(PickDateFromCal.txt) to the skydrive. This is the download link https://skydrive.live.com/cid=FF2D8B0A9A701D23&id=FF2D8B0A9A701D23%21107#cid=FF2D8B0A9A701D23&id=FF2D8B0A9A701D23%21107

    Thanks



    Monday, September 23, 2013 7:50 PM
  • Hello,

    I can't get the application from the link. Please make sure you upload them to the Public folder so that I have enough permissions to access it.

    Thanks,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, September 24, 2013 11:22 AM
  • Hi,

    I have uploaded application and script in public folder.This is the download link https://skydrive.live.com/?cid=FF2D8B0A9A701D23&id=FF2D8B0A9A701D23%21105

    Thanks

    Aarti


    • Edited by Kumari Aarti Wednesday, September 25, 2013 6:43 AM
    Wednesday, September 25, 2013 6:40 AM
  • Hello,

    Based on your application, I find when I record to click one date on the calendar UI, the action on some date will be recorded as: Click 'monthCalendar1' calendar for example click ‘9/6/2013’and ’9/7/2013’but sometimes the action on other data such as ‘9/11/2013’will be recorded as: Select '9/1/2013' in 'monthCalendar1' calendar

    When the action is recorded as Select '9/1/2013' in 'monthCalendar1' calendar, the playback will fail and an unexpected date will be selected.

    When the click action is recorded as: Click 'monthCalendar1' calendar, the playback will success and expected data will be selected.

    Whether you work with standard Winform Calendar control in your application? If yes, to get the issue confirmed and diagnose by product team, would you please create connect report for it? You will get email notification for update.http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx, if you submit it, you could share us the link here, so we could know the latest information from the Product team expert. And I will help you to vote it.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 7:28 AM
  • I have posted it in Microsoft Connect. Please see the link

    https://connect.microsoft.com/VisualStudio/feedback/details/802374/

    Let me know, if there is any difficulty to access the link.

    Thanks.

    Thursday, September 26, 2013 4:27 PM
  • Hello,

    Your link is OK. I have voted it.

    Thanks,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, September 27, 2013 1:24 AM