Hello,
When I am attempting to start a form (with DragDrop enabled) within a
new thread, I get the following exception. This is ONLY the case with
..NET 2.0 and did not occur in 1.1. I ABSOLUTELY MUST start this form in
a new thread. There is no getting around this. The fact that it
functioned properly when compiled for 1.1 is highly irritating.
{System.InvalidOperationException: DragDrop registration did not
succeed. ---> System.Threading.ThreadStateException: Current thread
must be set to single thread apartment (STA) mode before OLE calls can
be made. Ensure that your Main function has STAThreadAttribute marked
on it.
at System.Windows.Forms.Control.SetAcceptDrops(Boolea n accept)
--- End of inner exception stack trace ---
at System.Windows.Forms.Control.SetAcceptDrops(Boolea n accept)
at System.Windows.Forms.Control.set_AllowDrop(Boolean value)
at Kapsules.frmWidget.InitializeComponent()
at Kapsules.frmWidget..ctor()
at Kapsules.CWidgetThread.Load()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()}
I would appreciate any help with this matter, as my posts on the
Microsoft newgroups and websites have gone unanswered. Could be another
one of those lovely 'features' that snuck its way in there.
Thanks