The datetime picker control 'focused' property is not set to true even though I have changed the date value.

Please anyone help me

Regards,
Jineesh

Recommended Answers

All 2 Replies

What is your need actually, be clearer!!
Do you need to set focus to datetimepicker when form loads, then??
use this code in constructor or form load event.

this.ActiveControl = datetimepicker1;

Thanks for your answer..

I have used datetime Picker in a custom control for selecting dates. for which I have used 2 datetime pickers.
using the event valuechanged I wrote the code. please read it.

private void dtp_ValueChanged(object sender, EventArgs e)
        {
            Control ctrl = (Control)sender;
            if (ctrl.Focused)
            {
                StartDate = dtpStartDate.Value;
                EndDate = dtpEndDate.Value;
                SelectedDateRange = DateRange.Custom;
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.