VB.net Use code to open two DateTimePickers at the same time

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I am using the following code to try to open two DateTimePicker control calendars but as expected
the first one closes when the second one is opened. Is there a way to open both calendars on both controls
at the sametime

          Me.DateTimePicker1.Select()
            SendKeys.Send("%{DOWN}")
            Me.DateTimePicker2.Select()
            SendKeys.Send("%{DOWN}")[code]

Open in new window

[/code]
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AndyAinscowFreelance programmer / Consultant
Commented:
I don't think there is.  To the best of my knowledge the calendar part is programmed to close as soon as soon as it loses the focus, which you do with the .Select() function call.
Fernando SotoRetired
Distinguished Expert 2017
Commented:
To your question, "Is there a way to open both calendars on both controls at the sametime", and adding to Andy's comment there can only be one control active an any one time and therefore in answer to this question no.
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
If you need them both visible at the same time, use two MonthCalendar controls instead:
https://msdn.microsoft.com/en-us/library/0xah4ckt(v=vs.110).aspx
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Murray BrownASP.net/VSTO Developer

Author

Commented:
Thank you all. I appreciate the  help
AndyAinscowFreelance programmer / Consultant

Commented:
@Fernando
re.  there can only be one control active an any one time...
Correct BUT just because a control loses focus doesn't automatically hide that control (in this case a popup window).  One can have multiple popup windows open simultaneously if they are so programmed.  Some controls, such as the calendar part of the date time picker, are coded to be disposed of when another control is selected.
Fernando SotoRetired
Distinguished Expert 2017

Commented:
@Andy

That is correct but in some cases such as the standard DateTimePicker once the control loses focus it automatically returns to it default view unless one has extended the controls functionality.
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial