Mothra Posted March 17, 2005 Posted March 17, 2005 Hey all, I have form that is running a long process on a separate thread. The process runs just fine but, if a certain condition is met, I want to set an error (with the .NET ErrorProvider control) to a text box. The problem I have is that the ErrorProvider sets, the icon shows for a second and then disappears! It works just fine if run the process on the SAME thread as the UI but, since it is a long process and there's plenty other things for the user to do, I'd rather keep it separated. Any ideas as to what may be causing my ErrorProvider to "un-set"? Quote Being smarter than you look is always better than looking smarter than you are.
Wile Posted March 18, 2005 Posted March 18, 2005 A breakpoint might help you with debugging. VS doesnt care about which thread hits the breakpoint, it breaks and gives you control over what happens next. So you can look where and how the error status is removed. Just put a breakpoint on basically every line where you use the errorprovider. Else some code could be usefull ;). Quote Nothing is as illusive as 'the last bug'.
Wraith Posted March 18, 2005 Posted March 18, 2005 When the errorprovider needs to set the error state marshal the call which will interact with the visual componant(s) back to the ui thread using form.InvokeRequired and form.Invoke, otherwise you will get unexpected and possibly wrong behavior. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.