Articles in this section
Category / Section

What should to when I get a "DragDrop registration failed" error as I try to run the application containing the WinForms GridControl?

1 min read

OLE drag and drop

The most likely cause of this problem is that your Main entry point does not have the [STAThread] attribute associated with it. Without this attribute, the Essential Grid support of the OLE Drag and Drop causes this error.

Solution:

There are two possible solutions. The first one is to add the [STAThread] attribute and remove the [MTAThread] attribute in case it is present. The second one is to remove the OLE Drag and Drop support from the Essential Grid.

Solution 1: Here is a sample Main entry point with the STAThread attribute.

C#

[STAThread]
static void Main()
{
    Application.Run(new Form1());
}

VB

<STAThread>
Shared Sub Main()
 Application.Run(New Form1())
End Sub

Solution 2: To remove OLE Drag and Drop support so that your application can be MTAThread.

  • Change the Main attribute [STAThread] to [MTAThread].
  • Turn the AllowDrop off.
  • Turn off the OLE options in the ControllerOptions.
  • Set the DataObjectConsumerOptions to none.

C#

[MTAThread]
static void Main()
{
    Application.Run(new Form1());            
}
//In Form_Load.
//Turns AllowDrop off.
this.gridControl1.AllowDrop = false;
//Turns off the OLE options in ControllerOptions
this.gridControl1.ControllerOptions -= GridControllerOptions.OleDataSource | GridControllerOptions.OleDropTarget;
//Sets DataObjectConsumerOptions value as “None”. 
this.gridControl1.DataObjectConsumerOptions = GridDataObjectConsumerOptions.None; 

VB

<MTAThread>
Shared Sub Main()
 Application.Run(New Form1())
End Sub
'In Form_Load
'Turns AllowDrop off.
Me.gridControl1.AllowDrop = False
'Turns off the OLE options in ControllerOptions.
Me.gridControl1.ControllerOptions -= GridControllerOptions.OleDataSource Or GridControllerOptions.OleDropTarget
' Sets DataObjectConsumerOptions value as “None”. 
Me.gridControl1.DataObjectConsumerOptions = GridDataObjectConsumerOptions.None

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied