DragDrop registration did not succeed

前端 未结 9 1721
时光取名叫无心
时光取名叫无心 2021-02-07 08:14

System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException:

What does this except

相关标签:
9条回答
  • 2021-02-07 08:47

    I found this error, and I see that the one that making it shown is when using another thread calling MessageBox.Show(this, ...), where this is not done initialized.

    We need to remove the owner of the message box to remove the error.

    0 讨论(0)
  • 2021-02-07 08:49

    Add the STAThreadAttribute attribute on the Main method. This attribute is required if your program access OLE related functions, like Clipboard class does.

    [STAThread]

    static void Main(string[] args)

    {

    }

    0 讨论(0)
  • 2021-02-07 08:54

    I solved this error by using below code...I were using Background Worker and trying to access UI while background worker..that is why getting error - DragDrop registration did not succeed. We cannot access UI from the code running in background worker or in thread.

    BeginInvoke((MethodInvoker)delegate
    {
    //write your code here...
    
    });
    

    Thanks Happy Coding... :

    0 讨论(0)
提交回复
热议问题