Need help resolving System.InvalidOperationException: 'Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.'
My C# Windows Forms App on .NET 9 launches a separate Form from the main UI thread and runs it on another thread. Everything works except when I click on the View ToolStripMenuItem I get the InvalidOperationException indicating cross-thread operation is not valid: Control. The click of View does not have any Event handlers that get launched (there are dopdown items under View but II don't get that far). I have another Test ToolStripMenuItem's that I can click just fine and dropdown items under them can be clicked and launch Event handlers fine also.
I have looked over the properties on the menu item and looked over the *.designere.cs code in detail and I don't see anything wrong.
For illustration purposes, the following shows my form and when I click on View I get the cross-thread (InvalidOperationException) but when I click on Test it works and I can click submenu items under Test that actuallly launch Event handers.
Any ideas would be appreciated.
My C# Windows Forms App on .NET 9 launches a separate Form from the main UI thread and runs it on another thread. Everything works except when I click on the View ToolStripMenuItem I get the InvalidOperationException indicating cross-thread operation is not valid: Control. The click of View does not have any Event handlers that get launched (there are dopdown items under View but II don't get that far). I have another Test ToolStripMenuItem's that I can click just fine and dropdown items under them can be clicked and launch Event handlers fine also.
I have looked over the properties on the menu item and looked over the *.designere.cs code in detail and I don't see anything wrong.
For illustration purposes, the following shows my form and when I click on View I get the cross-thread (InvalidOperationException) but when I click on Test it works and I can click submenu items under Test that actuallly launch Event handers.
Any ideas would be appreciated.