Re: Invoke vs .... (for thread communication with UI controls)
From: _e_ (_nomail_at_nomail.com)
Date: 03/19/04
- Next message: William Morris: "Re: Error message I don't understand (newbie Q)"
- Previous message: clintonG: "Re: Directory structure advice needed"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Invoke vs .... (for thread communication with UI controls)"
- Messages sorted by: [ date ] [ thread ]
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.
- Next message: William Morris: "Re: Error message I don't understand (newbie Q)"
- Previous message: clintonG: "Re: Directory structure advice needed"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Invoke vs .... (for thread communication with UI controls)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|