DragDrop registration failed

Docking/MDI for Windows Forms Forum

Posted 19 years ago by Chris Austin
I'm getting an InvalidOperationException "DragDrop registration failed." when I try to add a document programmatically.

I've created a "dummy" user control with a label and text box on. When I add the control with the following code, I get the above exception:

private void menuItem3_Click(object sender, EventArgs e)
Dummy control = new Dummy();
DocumentWindow docWin = new DocumentWindow (dockManager1, "key", "hello", null, control);

It works when MdiDocumentStyle is "Standard", but I get the exception when MdiDocumentStyle is "Tabbed".

Comments (2)

Posted 19 years ago by Jay Herring
I had a similar problem. The fix is very simple. If you look at the exception generated it says something about needing single threaded apartment model.

Add the the [STAThread] attribute to your Main method and all should work.


public static void Main()
// Do stuff
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Yes that error has been well documented as an oddity of the .NET framework. If you Google it you'll find all kinds of results on it. It's something to do with Microsoft's code, not ours.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.