I tried to wrote this code to update the text of a textBox while backgroundworker is working.
#region variables
        public delegate void updateTextBoxDelegate(string s, bool directory);
        updateTextBoxDelegate delegateTextBox;
#endregion
#region somewhereInsideForm1Constructor
        delegateTextBox = new updateTextBoxDelegate(updateTextBox);
#endregion
#region methods
        public void updateTextBox(string s, bool directory)
        {
            if (directory)
            {
                textBox1.Text += s + System.Environment.NewLine;
            }
            else
            {
                textBox1.Text += "   --> " + s + System.Environment.NewLine;
            }
        }
#endregion
#region somewhereInsideBackGroundWorker_doWork
       delegateTextBox(path.FullName, true);
#endregion
and in this situation occurs an Exception of Cross Threading:
here:
      textBox1.Text += s + System.Environment.NewLine;
and here:
      delegateTextBox(path.FullName, true);
What's the error???
Thanks!
 
    