Answer the question
In order to leave comments, you need to log in
Invalid operation in multiple threads?
I can't figure out what the code is asking me to do. Wrote an event handler for a button click. When the button is pressed, everything works. As soon as I transferred this code to the event of receiving data from the COM port, it swears at it ->
An "System.InvalidOperationException" exception occurred in System.Windows.Forms.dll ("Invalid multi-threaded operation: Attempted to access control 'dataGridView1' from a thread other than the thread it was created on.")
Answer the question
In order to leave comments, you need to log in
You cannot work with graphic elements from another thread. Use Invoke.
https://msdn.microsoft.com/en-us/library/zyzhdc6b(...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question