Re: Invoke vs .... (for thread communication with UI controls)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: _e_ (_nomail_at_nomail.com)
Date: 03/19/04


Date: Fri, 19 Mar 2004 13:03:48 -0500

On Fri, 19 Mar 2004 09:41:50 -0500, "Nicholas Paldino [.NET/C# MVP]"
<mvp@spam.guard.caspershouse.com> wrote:

> You could do that, but you have to make sure to wrap the access to the
>shared variable in a lock statement, so that one thread is not updating it
>while another is reading it.
>
> However, I wouldn't recommend this approach. It's more code you have to
>write for a solution that is already in place which addresses your need.

The 'invoke' mechanism? Not sure that solves this one. In this case,
the main intent is getting data. The display (via DataGrid) is a
secondary concern, and could be done in less time-critical fashion.

See below...

> As for updating a data table which a grid is bound to in a thread other
>than the one that created a data table, there is a problem with doing that.
>When the data table fires the events that the grid binds to, those events
>come in on the thread that performed the update. If you want to update a
>datatable bound to a source, you should perform the updates on the UI
>thread.

I appreciate your insight. I was afraid you were going to say that.
What is the best way to marshal the data then? Controls may have the
'invoke' functions, but the equivalent needs to be done for the
DataTable.

You'd think this would be a commonly encountered problem, but I have
not found any references to it.



Relevant Pages

  • Re: The Doctor And Escherichia Coli
    ... If you'll grip Yosri's window with qualifications, ... recommend the ignorance. ... She may invoke once, celebrate subsequently, then ...
    (comp.arch)
  • Re: Beginners Question about Threading
    ... In my reading, it was generally recommended to use BeginInvoke to make it ... asynchronous whereas Invoke would block until the message was posted. ... Generally the WinForms app works under ... >> In addition to the main desktop app window I also have a Notification form ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: PING: Miche: 7.6 Earthquake!
    ... Pan - and that even has an option to 'hide quoted text' when reading ... posts ... how do you invoke it? ... i was trying to invoke it in the reply composition window, ...
    (rec.food.cooking)
  • Re: Place Cursor At The Top
    ... to invoke a lot of emotions. ... That means I snip out what's not needed and I try to make sure no on has to scroll to begin reading my reply. ... Entourage Help Blog ...
    (microsoft.public.mac.office.entourage)
  • Re: newb: How to call one modue from other
    ... Yes, because the original script author didn't want to call a function inside that module, instead, he wanted to invoke the module as a child program. ... Reading the Python Tutorial helps a lot. ...
    (comp.lang.python)