Return to Snippet

Revision: 36742
at November 25, 2010 18:26 by falconzy


Initial Code
delegate void updateLabelTextDelegate(string newText);
private void updateLabelText(string newText)
        {
            if (lblMessage.InvokeRequired) //lblMessage UI ID
            {
                // this is worker thread
                updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
                lblMessage.Invoke(del, new object[] { newText });
            }
            else
            {
                // this is UI thread
                lblMessage.Text = newText;
            }
        }

Initial URL

                                

Initial Description

                                

Initial Title
Cross thread update Windows Form

Initial Tags
form, windows, update

Initial Language
C#