Questions tagged [cross-thread]
38 questions
-1
votes
1 answer
How should I simplify the code for updating controls on the UI thread by Dispatcher
My codes need to update some UI element by triggerd event, and some of event is trigged in async or background thread, not in STA thread. So I need use Dispatcher.Invoke in event handler.
But there is so many same situation need to apply. These…

Mr. Squirrel.Downy
- 880
- 7
- 23
-1
votes
2 answers
Windows MessageBox Display Issue with Cross Thread
I am trying to display error message notification using MessageBox.Show() method. But I am getting Cross thread operation issue. I used the below code. How can I resolve the cross thread issue? I tried with MethodInvoker but it is not solving my…

Suryakavitha
- 1,371
- 5
- 33
- 49
-1
votes
1 answer
C# serial port does not show output in textbox
Hi all I am pretty new to C# and Arduino. When i send to text to my Arduino it does not send it back to the textbox in the app. I can send it to my Arduino but I get the error when the message I send has to be in the textbox in the application.
Here…

Kip Verslaafde
- 153
- 8
-1
votes
1 answer
How to run the same background worker and stop it inside a loop in C#
I performed a genetic algorithm that loops 10 times where each time I call the "FitnessFunction" function, I use a background worker to move an object on the topology and once it reach a specific point then I cancel that background worker and back…

Rose
- 349
- 3
- 17
-1
votes
1 answer
How to set text to element created in another thread
Before starting, I know that already have a bunch of answers for that question, but let me explain what's happening.
I basically want append some texts to a RichTextBox element, it serves to me like a logger to inform to user each action from a file…

fellyp.santos
- 136
- 2
- 13
-2
votes
2 answers
Progressbar in Waiting Message Form - Error: InvalidOperationException Cross-thread operation not valid - C#
I have the the following method to show in a gridview (dgJEARequests) a customized selection of items, as you can see from the images. The user will select the items that will send the parameters to the query whereStatement. But when many checkboxes…

Mr. Munoz
- 69
- 1
- 3
- 13
-3
votes
1 answer
Background worker Is busy error and I want to implement in progress bar
private void button1_Click(object sender, EventArgs e)
{
//progress bar
backgroundWorker1.RunWorkerAsync();
progressBar1.Value = 1;
progressBar1.Minimum = 1;
progressBar1.Maximum = 10;
label3.Text = "backgroundworker Task…

samccxr
- 3
- 3
-4
votes
2 answers
Modifying Datagrid.Columns from any thread in WPF
(I use .Net 4.5, with Visual Studio 2017. Minimal example link has been added at the end of the post, and is ready to run/crash without anything to do if you want to see the things by yourselves)
I have a UserControl that contains a DataGrid in WPF.…

Poc
- 109
- 10