all groups > dotnet interop > december 2005 >
You're in the

dotnet interop

group:

COM Interop & GUI Update Problems


COM Interop & GUI Update Problems Diego
12/22/2005 11:41:02 AM
dotnet interop:
Hi,
I'm writing a C# Windows Application (VS2005) with a label on a Windows
Form. I'm using COM Interop to wrap a legacy COM Object and I would like to
receive a particular event from my object and then update the text in the
label.
Following the MSDN library explanations the event is captured correctly but
it seems that the GUI is not updated coherently...I had the same results with
whatever control on the form.
A quite similar code on VS 2003 seems to work fine...

May you help me?
RE: COM Interop & GUI Update Problems Diego
12/23/2005 2:21:02 AM
Ok, I found it.
It's not a matter of COM Interop but is well known as a problem due to
trying to access a control from a thread different from the one that created
it.

Solutions can be found here
http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en (see
control.Invoke())

even if is a little bit code-consuming if you want only to change some
property of a control!

[quoted text, click to view]
AddThis Social Bookmark Button