How to communicate between two UI Threads

In a c# windows application i have 2 forms namely form1 and form2 in the form one if i click a button it will show the form 2 with a label. I want to pass a value from form1 to form2 label control. But i get cross thread violation error. I searched the net but i all the discussions are about communication between UI Thread and Backgroundworker Thread. How i can communicate between this Two UI Threads?
private void btnStart_Click(object sender, EventArgs e)
        {
            form2 mform = new form2();
 
 
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(mform.Show));
 
            t.Start();
            for (int i = 0; i < 100; i++)
            {
                mform.label1.Text = i.ToString();   // <-----   Cross Thread Violation Here
                System.Threading.Thread.Sleep(10000);
               
            }
        }

Open in new window

JRumanaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

andrewjbCommented:
Same was as if you're calling from a background worker...

You need to call .Invoke on the "other" form and pass a method to set the label value etc.
0
andrewjbCommented:
(was) -> (way)
0
DhaestCommented:
Perhaps you should take a look at this article: Updating the UI from a Secondary Thread
http://msdn.microsoft.com/en-us/magazine/cc188732.aspx
http://weblogs.asp.net/justin_rogers/articles/126345.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.