Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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"?

Being smarter than you look is always better than looking smarter than you are.
Posted

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 ;).

Nothing is as illusive as 'the last bug'.
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...