How Invoke work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How Invoke work?

When I use invoke is this mean I am in UI thread and my function is executed in UI thread or just the control is in UI thread

21st Jan 2019, 8:57 AM
Mohand Gesm
Mohand Gesm - avatar
2 Answers
+ 3
Invoke is something which can be called in all threads. It does not tell you that you are in the UI-thread. It can be translated to "Do this method now" The method is the method where the delegate is pointing to. http://www.tutorialsteacher.com/csharp/csharp-delegates Are you creating a own delegate or are you trying to solve the "The calling thread cannot access this object because a different thread owns it." exception
21st Jan 2019, 8:45 PM
sneeze
sneeze - avatar
0
Thanks you sneeze, my problem was is I using thread, which include to invoke Datagridview and I using for loop to delete a lot of rows from datatable that bound to Datagridview, and my program is not responding when it came to delete, sorry for bad English.
22nd Jan 2019, 4:17 AM
Mohand Gesm
Mohand Gesm - avatar