How can i use a textBox.Text in backgroundworker without using cross thread?
<p>This is the line in the dowork event</p>

<pre><code>List&lt;string&gt; Result = SearchInFile(CurrentFileWithPath, textBox2.Text);
</code></pre>

<p>And this is the whole dowork event code</p>

<pre><code>object[] CurrentStatus;
        private void _FileProcessingWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int countmore = 0;
            try
            {
                //object[] CurrentStatus = new object[5];
                DirectoryInfo[] MySubDirectories = (DirectoryInfo[])e.Argument;
                for (int i = 0; i &lt; MySubDirectories.GetLength(0); i++)
                {
                    DirectoryInfo MySubDirectory = MySubDirectories[i];

                    List&lt;FileInfo&gt; l = new List&lt;FileInfo&gt;();
                    CountFiles(MySubDirectory, l);
                    CurrentStatus = new object[6];
                    int totalFiles = l.Count;
                    CurrentStatus[3] = i.ToString();
                    countmore += totalFiles;
                    CurrentStatus[4] = countmore;
                    _FileProcessingWorker.ReportProgress(0, CurrentStatus);

                    string CurrentDirectory = "Current Directory: " + MySubDirectory.Name;

                    foreach (FileInfo MyFile in l)
                    {
                        CurrentStatus = new object[6];
                        if (_FileProcessingWorker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }

                        if (MyFile.Extension.ToLower() == ".cs" || MyFile.Extension.ToLower() == ".vb")
                        {
                            string CurrentFile = "Current File: " + MyFile.Name;
                            string CurrentFileWithPath = MyFile.FullName;

                            CurrentStatus[0] = CurrentDirectory;
                            CurrentStatus[1] = CurrentFile;
                            _FileProcessingWorker.ReportProgress(0, CurrentStatus);

                            List&lt;string&gt; Result = SearchInFile(CurrentFileWithPath, textBox2.Text);

                            if (Result != null &amp;&amp; Result.Count &gt; 0)
                            {
                                CurrentStatus[2] = Result;
                                _FileProcessingWorker.ReportProgress(0, CurrentStatus);
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                return;
            }  
        }
</code></pre>

<p>I'm not getting errors but using a break point I see on the textBox2 text:
Text = The function evaluation requires all threads to run.</p>

<p>If there is no other way how to use cross thread with it ?</p>