This question has already been answered:
- Work with controls from background thread 2 responses
Program: processes the text (counts words, etc.).
In the program: there is a method in which the line is assembled:
private void PrintResume() { strText.Append("Первая строка: " + int1 + Environment.NewLine); strText.Append("Вторая строка: " + int2 + Environment.NewLine); richTextBox2.Text += strText.ToString(); } And accordingly, richTextBox2 , which is inside tabPage6 .
It works fine, except if you switch the tab (there are several of them, with richTextBoxes and listviews). In this case, the program begins to swear that " попытка доступа к richTextBox2 не из того потока, в котором он был создан ." Moreover, if you switch to tabs from the listview, this does not happen.
What could be the problem?