c++/cli c# winforms cross-thread operation sometimes possible
问题 I am using c++/cli (should also apply to c#) and creating a winforms program. I have some lines of code that edit data in a DataGridView. The code is executed by an FileSystemWatcher event, but it could be executed by a background worker or a simple thread. However, it is NOT executed by the UI thread. The DGV is placed on a tab of a TabControl. When the code is executed while the DGV-containing tab has the focus, the code fails with the well-known and expected exception " Cross-thread