I have a simple data input form in which when the form is activated if sets focus on a textbox and sets the back color. I later have a datetimepicker control. The tab stops are coreectly set but when ever the users selects a a date from the datetimepicker the form seems to send a form activated event, because the cursur/focus moves to the first textbox instead of the next tab stop. If I comment out the "form activated" event the form functions properly. Why does this happen? Does the datetimepicker send "form activated"? How can I work around this. I want to set the focus only the first time the form is loaded, from that point on I want the tab control to dictate the navigation.

thanks

I want to set the focus only the first time the form is loaded, from that point on I want the tab control to dictate the navigation.

Then use either the Form.Shown event or Form.Load event.

I will try the form.shown event...but can anyone explain why the datetimepicker functions the way it does...I would like to understand it.

The form deactivate/Activate only seems to occur in you use the MonthCalendar dropdown to make the selection.

It probably has to do with the MonthCalendar control being displayed a Modal window (like a dialog box) and it taking focus (hence the deactivation of the form) when clicked on. The form is reactivated when the MonthCalendar closes.

thank you for the explaination. The form.show event seems to handle everything need thanks again.

Your welcome.

Please close this thread out if you don't have any more questions.

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.