DateTimePicker Problem

S

Sumit

Hi all,

I have a datetimepicker on my windows form.
When the user selects it i check whether the date entered is a Sunday
or not & if its not a sunday i want that the control remains on the
DateTimePicker & the DateTimePicker is displayed in its expaned form
(i.e displaying the calendar).

If i do a datetimepicker.focus(), then the focus goes to the
datetimepicker but the user who is using it might ignore the focus as
nothing is highlighted as such.

Thats why i need to display the calender of the datetimepicker.

Kindly suggest a way..

Warm Regards
Sumit Vohra
 
N

Neno Loje [MVP C#]

Hi Sumit,

the solution that immediatly comes to Dr. Dirty's mind (the docutor for the
real "quick and dirty" stuff) is to use SendKeys after the call to Focus
like this:

<code>
dateTimePicker1.Focus();

SendKeys.Send("{F4}");

</code>

Although this will actually close the dropdown for some milliseconds and
then reopen it, it might also be a helpfull effect since the user will
notice the flashing.

Hope this helps,
Neno

--
Neno Loje [MVP C#]
http://www.dotnet-online.com

The answers by Dr. Dirty are provided "as-is" and no responsibility is taken
for the correctness of this information. Please do not try this at home and
keep it away from your children.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top