Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Safe Update Of Windows Control From Other Threads

DZone's Guide to

Safe Update Of Windows Control From Other Threads

·
Free Resource

        delegate void UpdateReportCallback(string text);
        private void UpdateReport(string message)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.textBoxReport.InvokeRequired)
            {
                UpdateReportCallback d = new UpdateReportCallback(UpdateReport);
                this.Invoke(d, new object[] { message });
            }
            else
            {
                textBoxReport.Text = message + System.Environment.NewLine + textBoxReport.Text;
            }
        }
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}