I have a C++ Windows Forms application that displays OpenGL in a NativeWindow contained by a Form that allows drag and drop. This application works fine when compiled with Visual Studio .Net 2003.
When I compile this app with Visual Studio .Net 2005 and run it, I get the following error:
And exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll.
Addition information: DragDrop registration did not succeed.
What can I do to get around this problem

DragDrop registratation did not succeed.
Bengt Gunne
Thanks.
A.Russell
Please do the following,
1) include the following
using System.Net;
using System.Threading;
2) add the [STAThread] Attribute just before ur main function and also remember to inlcude using System.Net; in ur main program,
[STAThread]
static void Main()
3) The steps are as follows for threading,
1. Put all the code ( for which u r getting this exception) in one function say function A. In the function B in which u are calling ur code,do the following,
function B
{
Thread t = new Thread(new ThreadStart(A));
t.SetApartmentState(ApartmentState.STA);
t.Start( );
}
function A
{
the code of Windows form..or whatever which is causing the error
}
Explanation:
It turns out that WF when executing all of its pretty pictures creates a thread to run each of those pictures with. These threads are in MTA mode (multi threaded apartments) and thus, in .Net 2.0 cannot be used for forms with drag and drop. so, any code which has AllowDrop Property true will give this error. With this came the following solution. All of the code used to create the form was placed in a single static function. The parent function, when it desires to call a new form ( windows form) , creates a thread, in STA mode, to execute this function. Thus the following code goes in the parent function
Thread t = new Thread(new ThreadStart(FormFunction));
t.SetApartmentState(ApartmentState.STA);
t.Start( );
I hope this will help.
Enjoy,
Sneha