[Python.NET] winForms, threading and dragdrop ?

Guy Robinson guy at r-e-d.co.nz
Mon Sep 12 05:38:55 CEST 2005

 From the attached code.With AllowDrop = True I get a .NET error as follows:

System.InvalidOperationException: DragDrop registration failed. ---> 
System.Threading.ThreadStateException: The current thread must set to Single 
Thread Apartment (STA) mode before OLE calls can be made.  Ensure that your Main 
function has STAThreadAttribute marked on it.

 From googling I need to set ApartmentState.STA. But this is readonly. How do I 
set STA correctly in Python for .NET?

Any thoughts appeciated.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: DnD_Tree2.py
Url: http://mail.python.org/pipermail/pythondotnet/attachments/20050912/d5dacdb2/DnD_Tree2.asc

More information about the PythonDotNet mailing list