|
-
December 3rd, 2008, 02:56 PM
#1
[RESOLVED] Cross Thread Function Calls
I have a function being executed by a timer. When I tried to make that function up date a label got an error about cross thread calls. Looking into this i found a solution from microsoft:
http://msdn.microsoft.com/en-us/library/ms171728.aspx
Code:
if (this.textBox1.InvokeRequired)
{
// It's on a different thread, so use Invoke.
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke
(d, new object[] { text + " (Invoke)" });
}
else
{
// It's on the same thread, no need for Invoke
this.textBox1.Text = text + " (No Invoke)";
}
However i cant access SetTextCallback. Dose anyone know where this object is located or if there is a better one for setting text values for labels?
I think SetTextCallback is just a delegate, and if so could i make my own to call the function in the other thread?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|