Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
754
UltraDateTimeEditor not thread-safe? Or strange invoke issue
posted

Dear all,

we have currently a form to which we dynamically add some self-written tab controls. One of this tabs uses a control which in turn uses a DateTime editor.

Now we have some external event, if it triggers we want to disable all the controls on this form. We therefore need to know if we need an invoke or not. Simply, all the tabs are subscribed to this event, and the event handlers make a check to see if InvokeRequired is true. If so, the tab sets its own Enabled property to false by calling a delegate, if not, Enabled is set to false directly.

This works for all tabs except for this one where we have the control with the DateTime editor. The exception which comes up says that the change to the DateTime´s Enabled-property cannot be made because the control was created on another thread.

So, the Parent´s Enabled property code seems to not check if it needs an Invoke for the cildren - but why on earth there is such a thing like controls being added to a parent control by another thread? We do not start any threads at all in this form constructor etc....

 

any ideas? thanks Florian